Skip to content

Commit f66a4e2

Browse files
(feat): embedded code snippets with latest API changes
1 parent 29c7376 commit f66a4e2

File tree

176 files changed

+8144
-1809
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

176 files changed

+8144
-1809
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
- name: Set up python
1111
uses: actions/setup-python@v4
1212
with:
13-
python-version: 3.7
13+
python-version: 3.8
1414
- name: Bootstrap poetry
1515
run: |
1616
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
@@ -26,7 +26,7 @@ jobs:
2626
- name: Set up python
2727
uses: actions/setup-python@v4
2828
with:
29-
python-version: 3.7
29+
python-version: 3.8
3030
- name: Bootstrap poetry
3131
run: |
3232
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
@@ -45,7 +45,7 @@ jobs:
4545
- name: Set up python
4646
uses: actions/setup-python@v4
4747
with:
48-
python-version: 3.7
48+
python-version: 3.8
4949
- name: Bootstrap poetry
5050
run: |
5151
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1

poetry.lock

Lines changed: 168 additions & 282 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "webflow"
3-
version = "1.0.0"
3+
version = "v1.1.0"
44
description = ""
55
readme = "README.md"
66
authors = []
@@ -9,12 +9,13 @@ packages = [
99
]
1010

1111
[tool.poetry.dependencies]
12-
python = "^3.7"
12+
python = "^3.8"
1313
httpx = ">=0.21.2"
14-
pydantic = ">= 1.9.2, < 2.5.0"
14+
pydantic = ">= 1.9.2"
15+
typing_extensions = ">= 4.0.0"
1516

1617
[tool.poetry.dev-dependencies]
17-
mypy = "0.971"
18+
mypy = "^1.8.0"
1819
pytest = "^7.4.0"
1920

2021
[build-system]

src/webflow/__init__.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
CustomCodeBlock,
2727
CustomCodeBlockType,
2828
CustomCodeResponse,
29+
Dom,
2930
Domain,
3031
DuplicateUserEmail,
3132
EcommerceSettings,
@@ -44,12 +45,17 @@
4445
FormSubmissionList,
4546
FormSubmissionTrigger,
4647
FormSubmissionTriggerPayload,
48+
ImageNode,
4749
InvalidDomain,
50+
InvalidScopes,
4851
InventoryItem,
4952
InventoryItemInventoryType,
5053
ListCustomCodeBlocks,
5154
MissingScopes,
5255
NoDomains,
56+
Node,
57+
NodeType,
58+
NotEnterprisePlanSite,
5359
OauthScope,
5460
Order,
5561
OrderAddress,
@@ -85,6 +91,8 @@
8591
ProductAndSkUs,
8692
ProductAndSkUsList,
8793
ProductFieldData,
94+
ProductFieldDataEcProductType,
95+
ProductFieldDataTaxCategory,
8896
PublishStatus,
8997
PublishedItems,
9098
PublishedSite,
@@ -96,12 +104,17 @@
96104
Site,
97105
SiteActivityLogItem,
98106
SiteActivityLogItemResourceOperation,
107+
SiteActivityLogItemUser,
99108
SiteActivityLogResponse,
100109
SitePublish,
101110
SitePublishPayload,
102111
Sites,
103112
Sku,
104113
SkuFieldData,
114+
SkuFieldDataCompareAtPrice,
115+
SkuFieldDataEcSkuBillingMethod,
116+
SkuFieldDataEcSkuSubscriptionPlan,
117+
SkuFieldDataEcSkuSubscriptionPlanInterval,
105118
SkuFieldDataPrice,
106119
SkuPropertyList,
107120
SkuPropertyListEnumItem,
@@ -110,6 +123,7 @@
110123
StripeCardBrand,
111124
StripeCardExpires,
112125
StripeDetails,
126+
TextNode,
113127
TriggerType,
114128
User,
115129
UserAccessGroupsItem,
@@ -136,11 +150,24 @@
136150
)
137151
from .resources import (
138152
AccessGroupsListRequestSort,
153+
DomWriteNodesItem,
139154
InventoryUpdateRequestInventoryType,
140155
OrdersListRequestStatus,
141156
OrdersRefundRequestReason,
157+
ProductSkuCreateProduct,
158+
ProductSkuCreateProductFieldData,
159+
ProductSkuCreateProductFieldDataEcProductType,
160+
ProductSkuCreateProductFieldDataTaxCategory,
161+
ProductSkuCreateSku,
162+
ProductSkuCreateSkuFieldData,
163+
ProductSkuCreateSkuFieldDataCompareAtPrice,
164+
ProductSkuCreateSkuFieldDataEcSkuBillingMethod,
165+
ProductSkuCreateSkuFieldDataEcSkuSubscriptionPlan,
166+
ProductSkuCreateSkuFieldDataEcSkuSubscriptionPlanInterval,
167+
ProductSkuCreateSkuFieldDataPrice,
142168
ProductsCreateSkuResponse,
143169
UsersListRequestSort,
170+
UsersUpdateRequestData,
144171
access_groups,
145172
assets,
146173
collections,
@@ -187,6 +214,8 @@
187214
"CustomCodeBlock",
188215
"CustomCodeBlockType",
189216
"CustomCodeResponse",
217+
"Dom",
218+
"DomWriteNodesItem",
190219
"Domain",
191220
"DuplicateUserEmail",
192221
"EcommerceSettings",
@@ -206,14 +235,19 @@
206235
"FormSubmissionList",
207236
"FormSubmissionTrigger",
208237
"FormSubmissionTriggerPayload",
238+
"ImageNode",
209239
"InternalServerError",
210240
"InvalidDomain",
241+
"InvalidScopes",
211242
"InventoryItem",
212243
"InventoryItemInventoryType",
213244
"InventoryUpdateRequestInventoryType",
214245
"ListCustomCodeBlocks",
215246
"MissingScopes",
216247
"NoDomains",
248+
"Node",
249+
"NodeType",
250+
"NotEnterprisePlanSite",
217251
"NotFoundError",
218252
"OauthScope",
219253
"Order",
@@ -252,6 +286,19 @@
252286
"ProductAndSkUs",
253287
"ProductAndSkUsList",
254288
"ProductFieldData",
289+
"ProductFieldDataEcProductType",
290+
"ProductFieldDataTaxCategory",
291+
"ProductSkuCreateProduct",
292+
"ProductSkuCreateProductFieldData",
293+
"ProductSkuCreateProductFieldDataEcProductType",
294+
"ProductSkuCreateProductFieldDataTaxCategory",
295+
"ProductSkuCreateSku",
296+
"ProductSkuCreateSkuFieldData",
297+
"ProductSkuCreateSkuFieldDataCompareAtPrice",
298+
"ProductSkuCreateSkuFieldDataEcSkuBillingMethod",
299+
"ProductSkuCreateSkuFieldDataEcSkuSubscriptionPlan",
300+
"ProductSkuCreateSkuFieldDataEcSkuSubscriptionPlanInterval",
301+
"ProductSkuCreateSkuFieldDataPrice",
255302
"ProductsCreateSkuResponse",
256303
"PublishStatus",
257304
"PublishedItems",
@@ -264,12 +311,17 @@
264311
"Site",
265312
"SiteActivityLogItem",
266313
"SiteActivityLogItemResourceOperation",
314+
"SiteActivityLogItemUser",
267315
"SiteActivityLogResponse",
268316
"SitePublish",
269317
"SitePublishPayload",
270318
"Sites",
271319
"Sku",
272320
"SkuFieldData",
321+
"SkuFieldDataCompareAtPrice",
322+
"SkuFieldDataEcSkuBillingMethod",
323+
"SkuFieldDataEcSkuSubscriptionPlan",
324+
"SkuFieldDataEcSkuSubscriptionPlanInterval",
273325
"SkuFieldDataPrice",
274326
"SkuPropertyList",
275327
"SkuPropertyListEnumItem",
@@ -278,6 +330,7 @@
278330
"StripeCardBrand",
279331
"StripeCardExpires",
280332
"StripeDetails",
333+
"TextNode",
281334
"TooManyRequestsError",
282335
"TriggerType",
283336
"UnauthorizedError",
@@ -293,6 +346,7 @@
293346
"UserWebhookPayloadTriggerType",
294347
"UsersListRequestSort",
295348
"UsersNotEnabled",
349+
"UsersUpdateRequestData",
296350
"WebflowEnvironment",
297351
"Webhook",
298352
"WebhookList",

src/webflow/client.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,29 @@
2323

2424

2525
class Webflow:
26+
"""
27+
Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propogate to these functions.
28+
29+
Parameters:
30+
- base_url: typing.Optional[str]. The base url to use for requests from the client.
31+
32+
- environment: WebflowEnvironment. The environment to use for requests from the client. from .environment import WebflowEnvironment
33+
34+
Defaults to WebflowEnvironment.DEFAULT
35+
36+
- access_token: typing.Union[str, typing.Callable[[], str]].
37+
38+
- timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 60 seconds.
39+
40+
- httpx_client: typing.Optional[httpx.Client]. The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
41+
---
42+
from webflow.client import Webflow
43+
44+
client = Webflow(
45+
access_token="YOUR_ACCESS_TOKEN",
46+
)
47+
"""
48+
2649
def __init__(
2750
self,
2851
*,
@@ -54,6 +77,29 @@ def __init__(
5477

5578

5679
class AsyncWebflow:
80+
"""
81+
Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propogate to these functions.
82+
83+
Parameters:
84+
- base_url: typing.Optional[str]. The base url to use for requests from the client.
85+
86+
- environment: WebflowEnvironment. The environment to use for requests from the client. from .environment import WebflowEnvironment
87+
88+
Defaults to WebflowEnvironment.DEFAULT
89+
90+
- access_token: typing.Union[str, typing.Callable[[], str]].
91+
92+
- timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 60 seconds.
93+
94+
- httpx_client: typing.Optional[httpx.AsyncClient]. The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
95+
---
96+
from webflow.client import AsyncWebflow
97+
98+
client = AsyncWebflow(
99+
access_token="YOUR_ACCESS_TOKEN",
100+
)
101+
"""
102+
57103
def __init__(
58104
self,
59105
*,

src/webflow/core/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,19 @@
33
from .api_error import ApiError
44
from .client_wrapper import AsyncClientWrapper, BaseClientWrapper, SyncClientWrapper
55
from .datetime_utils import serialize_datetime
6+
from .file import File, convert_file_dict_to_httpx_tuples
67
from .jsonable_encoder import jsonable_encoder
78
from .remove_none_from_dict import remove_none_from_dict
9+
from .request_options import RequestOptions
810

911
__all__ = [
1012
"ApiError",
1113
"AsyncClientWrapper",
1214
"BaseClientWrapper",
15+
"File",
16+
"RequestOptions",
1317
"SyncClientWrapper",
18+
"convert_file_dict_to_httpx_tuples",
1419
"jsonable_encoder",
1520
"remove_none_from_dict",
1621
"serialize_datetime",

src/webflow/core/client_wrapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def get_headers(self) -> typing.Dict[str, str]:
1414
headers: typing.Dict[str, str] = {
1515
"X-Fern-Language": "Python",
1616
"X-Fern-SDK-Name": "webflow",
17-
"X-Fern-SDK-Version": "0.1.0b2",
17+
"X-Fern-SDK-Version": "v1.1.0",
1818
}
1919
headers["Authorization"] = f"Bearer {self._get_access_token()}"
2020
return headers

src/webflow/core/file.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
import typing
4+
5+
# File typing inspired by the flexibility of types within the httpx library
6+
# https://github.com/encode/httpx/blob/master/httpx/_types.py
7+
FileContent = typing.Union[typing.IO[bytes], bytes, str]
8+
File = typing.Union[
9+
# file (or bytes)
10+
FileContent,
11+
# (filename, file (or bytes))
12+
typing.Tuple[typing.Optional[str], FileContent],
13+
# (filename, file (or bytes), content_type)
14+
typing.Tuple[typing.Optional[str], FileContent, typing.Optional[str]],
15+
# (filename, file (or bytes), content_type, headers)
16+
typing.Tuple[typing.Optional[str], FileContent, typing.Optional[str], typing.Mapping[str, str]],
17+
]
18+
19+
20+
def convert_file_dict_to_httpx_tuples(
21+
d: typing.Dict[str, typing.Union[File, typing.List[File]]]
22+
) -> typing.List[typing.Tuple[str, File]]:
23+
"""
24+
The format we use is a list of tuples, where the first element is the
25+
name of the file and the second is the file object. Typically HTTPX wants
26+
a dict, but to be able to send lists of files, you have to use the list
27+
approach (which also works for non-lists)
28+
https://github.com/encode/httpx/pull/1032
29+
"""
30+
31+
httpx_tuples = []
32+
for key, file_like in d.items():
33+
if isinstance(file_like, list):
34+
for file_like_item in file_like:
35+
httpx_tuples.append((key, file_like_item))
36+
else:
37+
httpx_tuples.append((key, file_like))
38+
return httpx_tuples
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
import typing
4+
5+
try:
6+
from typing import NotRequired # type: ignore
7+
except ImportError:
8+
from typing_extensions import NotRequired # type: ignore
9+
10+
11+
class RequestOptions(typing.TypedDict):
12+
"""
13+
Additional options for request-specific configuration when calling APIs via the SDK.
14+
This is used primarily as an optional final parameter for service functions.
15+
16+
Attributes:
17+
- timeout_in_seconds: int. The number of seconds to await an API call before timing out.
18+
19+
- additional_headers: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's header dict
20+
21+
- additional_query_parameters: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's query parameters dict
22+
23+
- additional_body_parameters: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's body parameters dict
24+
"""
25+
26+
timeout_in_seconds: NotRequired[int]
27+
additional_headers: NotRequired[typing.Dict[str, typing.Any]]
28+
additional_query_parameters: NotRequired[typing.Dict[str, typing.Any]]
29+
additional_body_parameters: NotRequired[typing.Dict[str, typing.Any]]

0 commit comments

Comments
 (0)