diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb1b2d3..14569f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,8 +33,10 @@ jobs: - name: Install dependencies run: poetry install + - name: Install Fern + run: npm install -g fern-api - name: Test - run: poetry run pytest ./tests/custom/ + run: fern test --command "poetry run pytest -rP ." publish: needs: [compile, test] diff --git a/.mock/definition/__package__.yml b/.mock/definition/__package__.yml new file mode 100644 index 0000000..667df1b --- /dev/null +++ b/.mock/definition/__package__.yml @@ -0,0 +1,2603 @@ +errors: + UnauthorizedError: + status-code: 401 + type: Error + docs: >- + Provided access token is invalid or does not have access to requested + resource + examples: + - value: + code: not_authorized + message: Request not authorized + ForbiddenError: + status-code: 403 + type: unknown + docs: Provided access token is valid, but is missing the required scopes. + examples: + - value: + code: missing_scopes + message: >- + OAuthForbidden: You are missing the following scopes - + components:write + - value: + code: forbidden + message: User is not authorized to perform this action + - value: + key: value + NotFoundError: + status-code: 404 + type: Error + docs: Requested resource not found + examples: + - value: + code: resource_not_found + message: 'Requested resource not found: The site cannot be found' + TooManyRequestsError: + status-code: 429 + type: Error + docs: >- + The rate limit of the provided access_token has been reached. Please have + your application respect the X-RateLimit-Remaining header we include on + API responses. + examples: + - value: + code: too_many_requests + message: Too many requests + BadRequestError: + status-code: 400 + type: unknown + docs: Request body was incorrectly formatted. + examples: + - value: + code: bad_request + message: 'Bad Request: Request is malformed' + - value: + key: value + - value: + code: validation_error + message: 'Validation Error: Provided ID is invalid' + InternalServerError: + status-code: 500 + type: Error + docs: We had a problem with our server. Try again later. + examples: + - value: + code: internal_error + message: An Internal Error occurred + ConflictError: + status-code: 409 + type: unknown + docs: Site is published to multiple domains at different times + examples: + - value: + message: '''Site is published to multiple domains at different times' + - value: + code: forms_require_republish + message: To access this feature, the site needs to be republished. + - value: + key: value + - value: + code: ecommerce_not_enabled + message: Ecommerce is not yet initialized +types: + BadRequestErrorBody: + discriminated: false + union: + - InvalidDomain + - NoDomains + source: + openapi: ../../../referenced-specs/v2.yml + ForbiddenErrorBody: + discriminated: false + union: + - InvalidScopes + - UsersNotEnabled + source: + openapi: ../../../referenced-specs/v2.yml + ConflictErrorBody: + discriminated: false + union: + - DuplicateUserEmail + - UserLimitReached + source: + openapi: ../../../referenced-specs/v2.yml + AuthorizedUser: + properties: + id: + type: optional + docs: The unique ID of the user + email: + type: optional + docs: The user's email address + validation: + format: email + firstName: + type: optional + docs: The user's first name + lastName: + type: optional + docs: The user's last name + source: + openapi: ../../../referenced-specs/v2.yml + ErrorCode: + enum: + - bad_request + - collection_not_found + - conflict + - duplicate_collection + - duplicate_user_email + - ecommerce_not_enabled + - forbidden + - forms_require_republish + - incompatible_webhook_filter + - internal_error + - invalid_auth_version + - invalid_credentials + - invalid_domain + - invalid_user_email + - item_not_found + - missing_scopes + - no_domains + - not_authorized + - not_enterprise_plan_site + - not_enterprise_plan_workspace + - order_not_found + - resource_not_found + - too_many_requests + - unsupported_version + - unsupported_webhook_trigger_type + - user_limit_reached + - user_not_found + - users_not_enabled + - validation_error + docs: Error code + source: + openapi: ../../../referenced-specs/v2.yml + ErrorDetailsItem: + discriminated: false + union: + - string + - map + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + Error: + properties: + code: + type: optional + docs: Error code + message: + type: optional + docs: Error message + externalReference: + type: optional + docs: Link to more information + details: + type: optional> + docs: Array of errors + source: + openapi: ../../../referenced-specs/v2.yml + Application: unknown + AuthorizationAuthorizationAuthorizedTo: + properties: + siteIds: + type: optional> + docs: Array of Sites this app is authorized to + workspaceIds: + type: optional> + docs: Array of Workspaces this app is authorized to + userIds: + type: optional> + docs: Array of Users this app is authorized to + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + AuthorizationAuthorization: + docs: The Authorization object + properties: + id: + type: optional + docs: The unique ID of the Authorization instance + createdOn: + type: optional + docs: The date the Authorization was created + lastUsed: + type: optional + docs: The date the Authorization was last used + grantType: + type: optional + docs: The grant type of the Authorization + rateLimit: + type: optional + docs: The default rate limit for the Authorization (requests/min) + scope: + type: optional + docs: Comma separted list of OAuth scopes corresponding to the Authorization + authorizedTo: optional + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + Authorization: + properties: + authorization: + type: optional + docs: The Authorization object + application: optional + source: + openapi: ../../../referenced-specs/v2.yml + Domain: + properties: + id: + type: string + docs: Unique identifier for the Domain + url: + type: optional + docs: The registered Domain name + source: + openapi: ../../../referenced-specs/v2.yml + Locale: + properties: + id: + type: optional + docs: The unique identifier for the locale. + cmsLocaleId: + type: optional + docs: A CMS-specific identifier for the locale. + enabled: + type: optional + docs: Indicates if the locale is enabled. + displayName: + type: optional + docs: The display name of the locale, typically in English. + displayImageId: + type: optional + docs: An optional ID for an image associated with the locale, nullable. + redirect: + type: optional + docs: Determines if requests should redirect to the locale's subdirectory. + subdirectory: + type: optional + docs: The subdirectory path for the locale, used in URLs. + tag: + type: optional + docs: >- + A tag or code representing the locale, often following a standard + format like 'en-US'. + source: + openapi: ../../../referenced-specs/v2.yml + Locales: + properties: + primary: + type: optional + docs: The primary locale for the site or application. + secondary: + type: optional> + docs: A list of secondary locales available for the site or application. + source: + openapi: ../../../referenced-specs/v2.yml + SiteDataCollectionType: + enum: + - always + - optOut + - disabled + docs: The type of data collection enabled for the site. + source: + openapi: ../../../referenced-specs/v2.yml + Site: + properties: + id: + type: string + docs: Unique identifier for the Site + workspaceId: + type: optional + docs: Unique identifier for the Workspace + createdOn: + type: optional + docs: Date the Site was created + displayName: + type: optional + docs: Name given to Site + shortName: + type: optional + docs: Slugified version of name + lastPublished: + type: optional + docs: Date the Site was last published + lastUpdated: + type: optional + docs: Date the Site was last updated + previewUrl: + type: optional + docs: URL of a generated image for the given Site + validation: + format: uri + timeZone: + type: optional + docs: Site timezone set under Site Settings + parentFolderId: + type: optional + docs: The ID of the parent folder the Site exists in + customDomains: optional> + locales: optional + dataCollectionEnabled: + type: optional + docs: Indicates if data collection is enabled for the site. + dataCollectionType: + type: optional + docs: The type of data collection enabled for the site. + source: + openapi: ../../../referenced-specs/v2.yml + Sites: + properties: + sites: optional> + source: + openapi: ../../../referenced-specs/v2.yml + Domains: + properties: + customDomains: optional> + source: + openapi: ../../../referenced-specs/v2.yml + InvalidDomain: unknown + NoDomains: unknown + SiteActivityLogItemEvent: + enum: + - styles_modified + - site_published + - ix2_modified_on_page + - page_dom_modified + - cms_item + - backup_created + - page_custom_code_modified + - symbols_modified + - variable_modified + - variables_modified + - cms_collection + - page_settings_modified + - page_settings_custom_code_modified + - ix2_modified_on_component + - ix2_modified_on_class + - site_custom_code_modified + - page_duplicated + - secondary_locale_page_content_modified + - page_renamed + - page_created + - page_deleted + - site_unpublished + - backup_restored + - locale_added + - branch_created + - locale_display_name_updated + - locale_subdirectory_updated + - branch_merged + - locale_tag_updated + - branch_deleted + - locale_enabled + - locale_removed + - locale_disabled + - library_shared + - library_unshared + - library_installed + - library_uninstalled + - library_update_shared + - library_update_accepted + - branch_review_created + - branch_review_approved + - branch_review_canceled + source: + openapi: ../../../referenced-specs/v2.yml + SiteActivityLogItemResourceOperation: + enum: + - CREATED + - MODIFIED + - PUBLISHED + - UNPUBLISHED + - DELETED + - GROUP_REORDERED + - GROUP_CREATED + - GROUP_DELETED + - REORDERED + source: + openapi: ../../../referenced-specs/v2.yml + SiteActivityLogItemUser: + properties: + id: optional + displayName: optional + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + SiteActivityLogItem: + properties: + id: optional + createdOn: optional + lastUpdated: optional + event: optional + resourceOperation: optional + user: optional + resourceId: optional + resourceName: optional + newValue: optional + previousValue: optional + payload: optional> + source: + openapi: ../../../referenced-specs/v2.yml + Pagination: + docs: Pagination object + properties: + limit: + type: optional + docs: The limit used for pagination + offset: + type: optional + docs: The offset used for pagination + total: + type: optional + docs: The total number of records + source: + openapi: ../../../referenced-specs/v2.yml + SiteActivityLogResponse: + properties: + items: optional> + pagination: optional + source: + openapi: ../../../referenced-specs/v2.yml + InvalidScopes: unknown + NotEnterprisePlanSite: unknown + CollectionListArrayItem: + docs: A collection object + properties: + id: + type: string + docs: Unique identifier for a Collection + displayName: + type: optional + docs: Name given to the Collection + singularName: + type: optional + docs: >- + The name of one Item in Collection (e.g. ”Blog Post” if the Collection + is called “Blog Posts”) + slug: + type: optional + docs: Slug of Collection in Site URL structure + createdOn: + type: optional + docs: The date the collection was created + lastUpdated: + type: optional + docs: The date the collection was last updated + source: + openapi: ../../../referenced-specs/v2.yml + CollectionList: + properties: + collections: + type: optional> + docs: An array of Collections + source: + openapi: ../../../referenced-specs/v2.yml + FieldType: + enum: + - PlainText + - RichText + - Image + - MultiImage + - Video + - Link + - Email + - Phone + - Number + - DateTime + - Switch + - Color + - ExtFileRef + docs: Choose these appropriate field type for your collection data + source: + openapi: ../../../referenced-specs/v2.yml + Field: + docs: The details of a field in a collection + properties: + id: + type: string + docs: Unique identifier for a Field + isRequired: + type: boolean + docs: define whether a field is required in a collection + isEditable: + type: optional + docs: Define whether the field is editable + type: + type: FieldType + docs: Choose these appropriate field type for your collection data + slug: + type: optional + docs: >- + Slug of Field in Site URL structure. Slugs should be all lowercase + with no spaces. Any spaces will be converted to "-." + displayName: + type: string + docs: The name of a field + helpText: + type: optional + docs: Additional text to help anyone filling out this field + source: + openapi: ../../../referenced-specs/v2.yml + Collection: + docs: A collection object + properties: + id: + type: string + docs: Unique identifier for a Collection + displayName: + type: optional + docs: Name given to the Collection + singularName: + type: optional + docs: >- + The name of one Item in Collection (e.g. ”Blog Post” if the Collection + is called “Blog Posts”) + slug: + type: optional + docs: Slug of Collection in Site URL structure + createdOn: + type: optional + docs: The date the collection was created + lastUpdated: + type: optional + docs: The date the collection was last updated + fields: + docs: The list of fields in the Collection + type: list + source: + openapi: ../../../referenced-specs/v2.yml + CollectionItemFieldData: + properties: + name: + type: string + docs: Name of the Item + slug: + type: string + docs: >- + URL structure of the Item in your site. Note: Updates to an item slug + will break all links referencing the old slug. + extra-properties: true + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + CollectionItem: + docs: > + A Collection Item represents a single entry in your collection. Each item + includes: + + + - **System metadata** - Automatically managed fields like IDs and + timestamp
+ + - **Status flags** - Controls for managing content state: `isDraft`, + `isArchived `
+ + - **Content fields** - Stored in `fieldData`. Each item needs a `name` and + `slug`, and may include additional fields matching your collection's + schema definition. + properties: + id: + type: optional + docs: Unique identifier for the Item + cmsLocaleId: + type: optional + docs: Identifier for the locale of the CMS item + lastPublished: + type: optional + docs: The date the item was last published + lastUpdated: + type: optional + docs: The date the item was last updated + createdOn: + type: optional + docs: The date the item was created + isArchived: + type: optional + docs: Boolean determining if the Item is set to archived + default: false + isDraft: + type: optional + docs: Boolean determining if the Item is set to draft + default: false + fieldData: CollectionItemFieldData + source: + openapi: ../../../referenced-specs/v2.yml + CollectionItemListPagination: + properties: + limit: + type: optional + docs: The limit specified in the request + default: 100 + offset: + type: optional + docs: The offset specified for pagination + default: 0 + total: + type: optional + docs: Total number of items in the collection + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + CollectionItemList: + docs: Results from collection items list + properties: + items: + type: optional> + docs: List of Items within the collection + pagination: optional + source: + openapi: ../../../referenced-specs/v2.yml + CollectionItemPostSingleFieldData: + properties: + name: + type: string + docs: Name of the Item + slug: + type: string + docs: >- + URL structure of the Item in your site. Note: Updates to an item slug + will break all links referencing the old slug. + extra-properties: true + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + CollectionItemPostSingle: + docs: > + A Collection Item represents a single entry in your collection. Each item + includes: + + + - **System metadata** - Automatically managed fields like IDs and + timestamp
+ + - **Status flags** - Controls for managing content state: `isDraft`, + `isArchived `
+ + - **Content fields** - Stored in `fieldData`. Each item needs a `name` and + `slug`, and may include additional fields matching your collection's + schema definition. + properties: + id: + type: optional + docs: Unique identifier for the Item + cmsLocaleId: + type: optional + docs: Identifier for the locale of the CMS item + lastPublished: + type: optional + docs: The date the item was last published + lastUpdated: + type: optional + docs: The date the item was last updated + createdOn: + type: optional + docs: The date the item was created + isArchived: + type: optional + docs: Boolean determining if the Item is in an archived state. + default: false + isDraft: + type: optional + docs: Boolean determining if the Item is in a draft state. + default: false + fieldData: CollectionItemPostSingleFieldData + source: + openapi: ../../../referenced-specs/v2.yml + CollectionItemWithIdInputFieldData: + properties: + name: + type: optional + docs: Name of the Item + slug: + type: optional + docs: >- + URL structure of the Item in your site. Note: Updates to an item slug + will break all links referencing the old slug. + extra-properties: true + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + CollectionItemWithIdInput: + docs: > + The fields that define the schema for a given Item are based on the + Collection that Item belongs to. Beyond the user defined fields, there are + a handful of additional fields that are automatically created for all + items + properties: + id: + type: string + docs: Unique identifier for the Item + cmsLocaleId: + type: optional + docs: Identifier for the locale of the CMS item + lastPublished: + type: optional + docs: The date the item was last published + lastUpdated: + type: optional + docs: The date the item was last updated + createdOn: + type: optional + docs: The date the item was created + isArchived: + type: optional + docs: Boolean determining if the Item is set to archived + isDraft: + type: optional + docs: Boolean determining if the Item is set to draft + fieldData: optional + source: + openapi: ../../../referenced-specs/v2.yml + CollectionItemListNoPagination: + docs: Results from collection items list + properties: + items: + type: optional> + docs: List of Items within the collection + source: + openapi: ../../../referenced-specs/v2.yml + BulkCollectionItemFieldData: + properties: + name: + type: optional + docs: Name of the Item + slug: + type: optional + docs: >- + URL structure of the Item in your site. Note: Updates to an item slug + will break all links referencing the old slug. + extra-properties: true + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + BulkCollectionItem: + docs: > + The fields that define the schema for a given Item are based on the + Collection that Item belongs to. Beyond the user defined fields, there are + a handful of additional fields that are automatically created for all + items + properties: + id: + type: string + docs: Unique identifier for the Item + cmsLocaleIds: + type: optional> + docs: Array of identifiers for the locales where the item will be created + lastPublished: + type: optional + docs: The date the item was last published + lastUpdated: + type: optional + docs: The date the item was last updated + createdOn: + type: optional + docs: The date the item was created + isArchived: + type: optional + docs: Boolean determining if the Item is set to archived + default: false + isDraft: + type: optional + docs: Boolean determining if the Item is set to draft + default: false + fieldData: optional + source: + openapi: ../../../referenced-specs/v2.yml + CollectionItemPatchSingleFieldData: + properties: + name: + type: optional + docs: Name of the Item + slug: + type: optional + docs: >- + URL structure of the Item in your site. Note: Updates to an item slug + will break all links referencing the old slug. + extra-properties: true + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + CollectionItemPatchSingle: + docs: > + The fields that define the schema for a given Item are based on the + Collection that Item belongs to. Beyond the user defined fields, there are + a handful of additional fields that are automatically created for all + items + properties: + id: + type: optional + docs: Unique identifier for the Item + cmsLocaleId: + type: optional + docs: Identifier for the locale of the CMS item + lastPublished: + type: optional + docs: The date the item was last published + lastUpdated: + type: optional + docs: The date the item was last updated + createdOn: + type: optional + docs: The date the item was created + isArchived: + type: optional + docs: Boolean determining if the Item is set to archived + isDraft: + type: optional + docs: Boolean determining if the Item is set to draft + fieldData: optional + source: + openapi: ../../../referenced-specs/v2.yml + PageSeo: + docs: SEO-related fields for the Page + properties: + title: + type: optional + docs: The Page title shown in search engine results + description: + type: optional + docs: The Page description shown in search engine results + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + PageOpenGraph: + docs: Open Graph fields for the Page + properties: + title: + type: optional + docs: The title supplied to Open Graph annotations + titleCopied: + type: optional + docs: Indicates the Open Graph title was copied from the SEO title + default: true + description: + type: optional + docs: The description supplied to Open Graph annotations + descriptionCopied: + type: optional + docs: >- + Indicates the Open Graph description was copied from the SEO + description + default: true + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + Page: + docs: The Page object + properties: + id: + type: string + docs: Unique identifier for the Page + siteId: + type: optional + docs: Unique identifier for the Site + title: + type: optional + docs: Title of the Page + slug: + type: optional + docs: slug of the Page (derived from title) + parentId: + type: optional + docs: Identifier of the parent folder + collectionId: + type: optional + docs: >- + Unique identifier for a linked Collection, value will be null if the + Page is not part of a Collection. + createdOn: + type: optional + docs: The date the Page was created + lastUpdated: + type: optional + docs: The date the Page was most recently updated + archived: + type: optional + docs: Whether the Page has been archived + default: false + draft: + type: optional + docs: Whether the Page is a draft + default: false + canBranch: + type: optional + docs: >- + Indicates whether the Page supports [Page + Branching](https://university.webflow.com/lesson/page-branching) + default: false + isBranch: + type: optional + docs: >- + Indicates whether the Page is a Branch of another Page [Page + Branching](https://university.webflow.com/lesson/page-branching) + default: false + isMembersOnly: + type: optional + docs: >- + Indicates whether the Page is restricted by [Memberships + Controls](https://university.webflow.com/lesson/webflow-memberships-overview#how-to-manage-page-restrictions) + default: false + seo: + type: optional + docs: SEO-related fields for the Page + openGraph: + type: optional + docs: Open Graph fields for the Page + localeId: + type: optional + docs: Unique ID of the page locale + publishedPath: + type: optional + docs: Relative path of the published page URL + source: + openapi: ../../../referenced-specs/v2.yml + PageList: + docs: The Page object + properties: + pages: optional> + pagination: optional + source: + openapi: ../../../referenced-specs/v2.yml + TextNode: + docs: > + Represents textual content within the DOM. It contains both the raw text + and its HTML representation, allowing for flexibility in rendering and + processing. Additional attributes can be associated with the text for + styling or other purposes. + properties: + html: optional + text: optional + source: + openapi: ../../../referenced-specs/v2.yml + ImageNode: + docs: > + Represents an image within the DOM. It contains details about the image, + such as its alternative text (alt) for accessibility and an asset + identifier for fetching the actual image resource. Additional attributes + can be associated with the image for styling or other purposes. + properties: + alt: optional + assetId: optional + source: + openapi: ../../../referenced-specs/v2.yml + NodeType: + enum: + - text + - image + source: + openapi: ../../../referenced-specs/v2.yml + Node: + docs: > + A generic representation of a content element within the Document Object + Model (DOM). Each node has a unique identifier and a specific type that + determines its content structure and attributes. + properties: + id: + type: optional + docs: Node UUID + type: optional + text: optional + image: optional + attributes: + type: optional> + docs: The custom attributes of the node + source: + openapi: ../../../referenced-specs/v2.yml + Dom: + docs: > + The DOM (Document Object Model) schema represents the content structure of + a web page. It captures various content nodes, such as text and images, + along with their associated attributes. Each node has a unique identifier + and can be of different types like text or image. The schema also provides + pagination details for scenarios where the content nodes are too many to + be fetched in a single request. + properties: + pageId: + type: optional + docs: Page ID + nodes: optional> + pagination: optional + source: + openapi: ../../../referenced-specs/v2.yml + ScriptApplyLocation: + enum: + - header + - footer + docs: >- + Location of the script, either in the header or footer of the published + site + default: header + source: + openapi: ../../../referenced-specs/v2.yml + ScriptApply: + properties: + id: + type: string + docs: ID of the registered custom code script + location: + type: ScriptApplyLocation + docs: >- + Location of the script, either in the header or footer of the + published site + default: header + version: + type: string + docs: Semantic Version String for the registered script *e.g. 0.0.1* + attributes: + type: optional> + docs: >- + Developer-specified key/value pairs to be applied as attributes to the + script + source: + openapi: ../../../referenced-specs/v2.yml + ScriptApplyList: + properties: + scripts: + type: optional> + docs: A list of scripts applied to a Site or a Page + lastUpdated: + type: optional + docs: Date when the Site's scripts were last updated + createdOn: + type: optional + docs: Date when the Site's scripts were created + source: + openapi: ../../../referenced-specs/v2.yml + CustomCodeHostedResponse: + docs: Registered custom code for application + properties: + id: + type: optional + docs: Human readable id, derived from the user-specified display name + canCopy: + type: optional + docs: >- + Define whether the script can be copied on site duplication and + transfer + default: false + displayName: + type: optional + docs: >- + User-facing name for the script. Must be between 1 and 50 alphanumeric + characters + hostedLocation: + type: optional + docs: URI for an externally hosted script location + integrityHash: + type: optional + docs: >- + Sub-Resource Integrity Hash. Only required for externally hosted + scripts (passed via hostedLocation) + createdOn: + type: optional + docs: Timestamp when the script version was created + lastUpdated: + type: optional + docs: Timestamp when the script version was last updated + version: + type: optional + docs: A Semantic Version (SemVer) string, denoting the version of the script + source: + openapi: ../../../referenced-specs/v2.yml + RegisteredScriptList: + docs: A list of scripts registered to the site + properties: + registeredScripts: optional> + source: + openapi: ../../../referenced-specs/v2.yml + CustomCodeInlineResponse: + docs: Registered custom code for application + properties: + id: + type: optional + docs: Human readable id, derived from the user-specified display name + canCopy: + type: optional + docs: >- + Define whether the script can be copied on site duplication and + transfer + default: false + displayName: + type: optional + docs: >- + User-facing name for the script. Must be between 1 and 50 alphanumeric + characters + hostedLocation: + type: optional + docs: URI for an externally hosted script location + integrityHash: + type: optional + docs: >- + Sub-Resource Integrity Hash. Only required for externally hosted + scripts (passed via hostedLocation) + createdOn: + type: optional + docs: Timestamp when the script version was created + lastUpdated: + type: optional + docs: Timestamp when the script version was last updated + version: + type: optional + docs: A Semantic Version (SemVer) string, denoting the version of the script + source: + openapi: ../../../referenced-specs/v2.yml + Scripts: + docs: A list of scripts applied to a Site or a Page + type: list + CustomCodeBlockType: + enum: + - page + - site + docs: Whether the Custom Code script is applied at the Site-level or Page-level + source: + openapi: ../../../referenced-specs/v2.yml + CustomCodeBlock: + docs: A specific instance of Custom Code applied to a Site or Page + properties: + siteId: + type: optional + docs: The Site ID where the custom code was applied + pageId: + type: optional + docs: The Page ID (if applied at Page-level) + type: + type: optional + docs: >- + Whether the Custom Code script is applied at the Site-level or + Page-level + scripts: optional + createdOn: + type: optional + docs: The date the Block was created + lastUpdated: + type: optional + docs: The date the Block was most recently updated + source: + openapi: ../../../referenced-specs/v2.yml + ListCustomCodeBlocks: + docs: Custom Code Blocks corresponding to where scripts were applied + properties: + blocks: optional> + pagination: optional + source: + openapi: ../../../referenced-specs/v2.yml + AssetVariant: + properties: + hostedUrl: + type: optional + docs: URL of where the asset variant is hosted + validation: + format: uri + originalFileName: + type: optional + docs: Original file name of the variant + displayName: + type: optional + docs: Display name of the variant + format: + type: optional + docs: format of the variant + width: + type: optional + docs: Width in pixels + height: + type: optional + docs: Height in pixels + quality: + type: optional + docs: Value between 0 and 100 representing the image quality + error: + type: optional + docs: Any associated validation errors + source: + openapi: ../../../referenced-specs/v2.yml + Asset: + properties: + id: + type: optional + docs: Unique identifier for this asset + contentType: + type: optional + docs: File format type + size: + type: optional + docs: size in bytes + siteId: + type: optional + docs: Unique identifier for the site that hosts this asset + hostedUrl: + type: optional + docs: Link to the asset + validation: + format: uri + originalFileName: + type: optional + docs: Original file name at the time of upload + displayName: + type: optional + docs: Display name of the asset + lastUpdated: + type: optional + docs: Date the asset metadata was last updated + createdOn: + type: optional + docs: Date the asset metadata was created + variants: optional> + altText: + type: optional + docs: The visual description of the asset + source: + openapi: ../../../referenced-specs/v2.yml + Assets: + docs: A list of assets + properties: + assets: optional> + source: + openapi: ../../../referenced-specs/v2.yml + AssetUploadUploadDetails: + docs: Metadata for uploading the asset binary + properties: + acl: optional + bucket: optional + X-Amz-Algorithm: optional + X-Amz-Credential: optional + X-Amz-Date: optional + key: optional + Policy: optional + X-Amz-Signature: optional + success_action_status: optional + content-type: optional + Cache-Control: optional + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + AssetUpload: + properties: + uploadDetails: + type: optional + docs: Metadata for uploading the asset binary + contentType: optional + id: optional + parentFolder: + type: optional + docs: Parent folder for the asset + uploadUrl: + type: optional + validation: + format: uri + assetUrl: + type: optional + docs: S3 link to the asset + validation: + format: uri + hostedUrl: + type: optional + docs: Represents the link to the asset + validation: + format: uri + originalFileName: + type: optional + docs: >- + Original file name when uploaded. If not specified at time of upload, + it may be extracted from the raw file name + createdOn: + type: optional + docs: Date the asset metadata was created + lastUpdated: + type: optional + docs: Date the asset metadata was last updated + source: + openapi: ../../../referenced-specs/v2.yml + AssetFolder: + docs: Asset Folder details + properties: + id: + type: optional + docs: Unique identifier for the Asset Folder + displayName: + type: optional + docs: User visible name for the Asset Folder + parentFolder: + type: optional + docs: Pointer to parent Asset Folder (or null if root) + assets: + type: optional> + docs: Array of Asset instances in the folder + siteId: + type: optional + docs: The unique ID of the site the Asset Folder belongs to + createdOn: + type: optional + docs: Date that the Asset Folder was created on + lastUpdated: + type: optional + docs: Date that the Asset Folder was last updated on + source: + openapi: ../../../referenced-specs/v2.yml + AssetFolderList: + docs: The Asset Folders object + properties: + assetFolders: + type: optional> + docs: A list of Asset folders + pagination: optional + source: + openapi: ../../../referenced-specs/v2.yml + TriggerType: + enum: + - form_submission + - site_publish + - page_created + - page_metadata_updated + - page_deleted + - ecomm_new_order + - ecomm_order_changed + - ecomm_inventory_changed + - user_account_added + - user_account_updated + - user_account_deleted + - collection_item_created + - collection_item_changed + - collection_item_deleted + - collection_item_unpublished + docs: > + * `form_submission` - Sends the [form_submission](#form_submission) event + + * `site_publish` - Sends a [site_publish](#site_publish) event + + * `page_created` - Send the [page_created](#page_created) event + + * `page_metadata_updated` - Sends the + [page_metadata_updated](#page_metadata_updated) event + + * `page_deleted` - Sends the [page_deleted](#page_deleted) event + + * `ecomm_new_order` - Sends the new [ecomm_new_order](#ecomm_new_order) + event + + * `ecomm_order_changed` - Sends the + [ecomm_order_changed](#ecomm_order_changed) event + + * `ecomm_inventory_changed` - Sends the + [ecomm_inventory_changed](#ecomm_inventory_changed) event + + * `user_account_added` - Sends the + [user_account_added](#user_account_added) event + + * `user_account_updated` - Sends the + [user_account_updated](#user_account_updated) event + + * `user_account_deleted` - Sends the + [user_account_deleted](#user_account_deleted) event + + * `collection_item_created` - Sends the + [collection_item_created](#collection_item_created) event + + * `collection_item_changed` - Sends the + [collection_item_changed](#collection_item_changed) event + + * `collection_item_deleted` - Sends the + [collection_item_deleted](#collection_item_deleted) event + + * `collection_item_unpublished` - Sends the + [collection_item_unpublished](#collection_item_unpublished) event + source: + openapi: ../../../referenced-specs/v2.yml + WebhookFilter: + docs: >- + Only supported for the `form_submission` trigger type. Filter for the form + you want Webhooks to be sent for. + properties: + name: + type: optional + docs: The name of the form you'd like to recieve notifications for. + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + Webhook: + properties: + id: + type: optional + docs: Unique identifier for the Webhook registration + triggerType: optional + url: + type: optional + docs: URL to send the Webhook payload to + workspaceId: + type: optional + docs: Unique identifier for the Workspace the Webhook is registered in + siteId: + type: optional + docs: Unique identifier for the Site the Webhook is registered in + filter: + type: optional + docs: >- + Only supported for the `form_submission` trigger type. Filter for the + form you want Webhooks to be sent for. + lastTriggered: + type: optional + docs: Date the Webhook instance was last triggered + createdOn: + type: optional + docs: Date the Webhook registration was created + source: + openapi: ../../../referenced-specs/v2.yml + WebhookList: + properties: + pagination: optional + webhooks: optional> + source: + openapi: ../../../referenced-specs/v2.yml + FormFieldValueType: + enum: + - Plain + - Email + - Password + - Phone + - Number + docs: The field type + source: + openapi: ../../../referenced-specs/v2.yml + FormFieldValue: + docs: An object containing field info for a specific fieldID. + properties: + displayName: + type: optional + docs: The field name displayed on the site + type: + type: optional + docs: The field type + placeholder: + type: optional + docs: The placeholder text for the field + userVisible: + type: optional + docs: Whether the field is visible to the user + source: + openapi: ../../../referenced-specs/v2.yml + FormField: + type: map + docs: A collection of form fields with additional properties. + FormResponseSettings: + docs: Settings for form responses + properties: + redirectUrl: + type: optional + docs: The url or path to redirect the user to after form submission + redirectMethod: + type: optional + docs: The HTTP request method to use for the redirectUrl (eg. POST or GET) + redirectAction: + type: optional + docs: The action to take after form submission + sendEmailConfirmation: + type: optional + docs: Whether to send an email confirmation to the user + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + Form: + docs: A Webflow form + properties: + displayName: + type: optional + docs: The Form name displayed on the site + createdOn: + type: optional + docs: Date that the Form was created on + lastUpdated: + type: optional + docs: Date that the Form was last updated on + fields: + type: optional + docs: A collection of form field objects + responseSettings: + type: optional + docs: Settings for form responses + id: + type: optional + docs: The unique ID for the Form + siteId: + type: optional + docs: The unique ID of the Site the Form belongs to + siteDomainId: + type: optional + docs: The unique ID corresponding to the site's Domain name + pageId: + type: optional + docs: The unique ID for the Page on which the Form is placed + pageName: + type: optional + docs: The user-visible name of the Page where the Form is placed + formElementId: + type: optional + docs: The unique ID of the Form element + workspaceId: + type: optional + docs: The unique ID of the Workspace the Site belongs to + source: + openapi: ../../../referenced-specs/v2.yml + FormList: + properties: + forms: optional> + pagination: optional + source: + openapi: ../../../referenced-specs/v2.yml + FormSubmission: + properties: + id: + type: optional + docs: The unique ID of the Form submission + displayName: + type: optional + docs: The Form name displayed on the site + siteId: + type: optional + docs: The unique ID of the Site the Form belongs to + workspaceId: + type: optional + docs: The unique ID of the Workspace the Site belongs to + dateSubmitted: + type: optional + docs: Date that the Form was submitted on + formResponse: + type: optional> + docs: The data submitted in the Form + source: + openapi: ../../../referenced-specs/v2.yml + FormSubmissionList: + properties: + formSubmissions: optional> + pagination: optional + source: + openapi: ../../../referenced-specs/v2.yml + UserDataData: + properties: + name: + type: optional + docs: | + The name of the user + email: + type: optional + docs: | + The email address of the user + accept-privacy: + type: optional + docs: | + Boolean indicating if the user has accepted the privacy policy + accept-communications: + type: optional + docs: | + Boolean indicating if the user has accepted to receive communications + additionalProperties: + type: optional + docs: Custom user attributes + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + UserData: + docs: An object containing the User's basic info and custom fields + properties: + data: optional + source: + openapi: ../../../referenced-specs/v2.yml + UserStatus: + enum: + - invited + - verified + - unverified + docs: The status of the user + source: + openapi: ../../../referenced-specs/v2.yml + UserAccessGroupsItemType: + enum: + - admin + - ecommerce + docs: | + The type of access group based on how it was assigned to the user. + * `admin` - Assigned to the user via API or in the designer + * `ecommerce` - Assigned to the user via an ecommerce purchase + source: + openapi: ../../../referenced-specs/v2.yml + UserAccessGroupsItem: + docs: Access group slugs and types + properties: + slug: + type: optional + docs: Access group identifier for APIs + type: + type: optional + docs: | + The type of access group based on how it was assigned to the user. + * `admin` - Assigned to the user via API or in the designer + * `ecommerce` - Assigned to the user via an ecommerce purchase + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + User: + docs: > + The fields that define the schema for a given Item are based on the + Collection that Item belongs to. Beyond the user defined fields, there are + a handful of additional fields that are automatically created for all + items + properties: + id: + type: optional + docs: Unique identifier for the User + isEmailVerified: + type: optional + docs: Shows whether the user has verified their email address + lastUpdated: + type: optional + docs: The timestamp the user was updated + invitedOn: + type: optional + docs: The timestamp the user was invited + createdOn: + type: optional + docs: The timestamp the user was created + lastLogin: + type: optional + docs: The timestamp the user was logged in + status: + type: optional + docs: The status of the user + accessGroups: + type: optional> + docs: Access groups the user belongs to + data: optional + source: + openapi: ../../../referenced-specs/v2.yml + UserList: + docs: The list users results + properties: + count: + type: optional + docs: Number of users returned + limit: + type: optional + docs: The limit specified in the request + default: 10 + offset: + type: optional + docs: The offset specified for pagination + default: 0 + total: + type: optional + docs: Total number of users in the collection + users: + type: optional> + docs: List of Users for a Site + source: + openapi: ../../../referenced-specs/v2.yml + UsersNotEnabled: unknown + DuplicateUserEmail: unknown + UserLimitReached: unknown + AccessGroup: + properties: + id: + type: optional + docs: Unique identifier for the Access Group + name: + type: optional + docs: Name of the the Access Group + shortId: + type: optional + docs: >- + Shortened unique identifier based on name, optimized for its use in + the user’s JWT + slug: + type: optional + docs: >- + Shortened unique identifier based on name, optimized for human + readability and public API use + createdOn: + type: optional + docs: The date the Access Group was created + source: + openapi: ../../../referenced-specs/v2.yml + AccessGroupList: + docs: The list access groups results + properties: + count: + type: optional + docs: Number of access groups returned + limit: + type: optional + docs: The limit specified in the request + default: 10 + offset: + type: optional + docs: The offset specified for pagination + default: 0 + total: + type: optional + docs: Total number of access groups in the collection + accessGroups: + type: optional> + docs: List of Site Access Groups + source: + openapi: ../../../referenced-specs/v2.yml + SkuPropertyListEnumItem: + docs: Enumerated Product variants/Options for the SKU + properties: + id: + type: string + docs: Unique identifier for a Product variant/Option + name: + type: string + docs: Name of the Product variant/Option + slug: + type: string + docs: Slug for the Product variant/Option in the Site URL structure + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + SkuPropertyList: + docs: A variant/option type for a SKU + properties: + id: + type: string + docs: Unique identifier for a collection of Product Variants + name: + type: string + docs: Name of the collection of Product Variants + enum: + docs: >- + The individual Product variants that are contained within the + collection + type: list + source: + openapi: ../../../referenced-specs/v2.yml + ProductFieldDataTaxCategory: + enum: + - value: standard-taxable + name: StandardTaxable + - value: standard-exempt + name: StandardExempt + - value: books-religious + name: BooksReligious + - value: books-textbook + name: BooksTextbook + - clothing + - value: clothing-swimwear + name: ClothingSwimwear + - value: digital-goods + name: DigitalGoods + - value: digital-service + name: DigitalService + - value: drugs-non-prescription + name: DrugsNonPrescription + - value: drugs-prescription + name: DrugsPrescription + - value: food-bottled-water + name: FoodBottledWater + - value: food-candy + name: FoodCandy + - value: food-groceries + name: FoodGroceries + - value: food-prepared + name: FoodPrepared + - value: food-soda + name: FoodSoda + - value: food-supplements + name: FoodSupplements + - value: magazine-individual + name: MagazineIndividual + - value: magazine-subscription + name: MagazineSubscription + - value: service-admission + name: ServiceAdmission + - value: service-advertising + name: ServiceAdvertising + - value: service-dry-cleaning + name: ServiceDryCleaning + - value: service-hairdressing + name: ServiceHairdressing + - value: service-installation + name: ServiceInstallation + - value: service-miscellaneous + name: ServiceMiscellaneous + - value: service-parking + name: ServiceParking + - value: service-printing + name: ServicePrinting + - value: service-professional + name: ServiceProfessional + - value: service-repair + name: ServiceRepair + - value: service-training + name: ServiceTraining + docs: Product tax class + source: + openapi: ../../../referenced-specs/v2.yml + ProductFieldDataEcProductType: + enum: + - ff42fee0113744f693a764e3431a9cc2 + - f22027db68002190aef89a4a2b7ac8a1 + - c599e43b1a1c34d5a323aedf75d3adf6 + - b6ccc1830db4b1babeb06a9ac5f6dd76 + docs: >- + Product + types. Enums reflect the following values in order: Physical, Digital, + Service, Advanced" + source: + openapi: ../../../referenced-specs/v2.yml + ProductFieldData: + docs: >- + Contains content-specific details for a product, covering both standard + (e.g., title, description) and custom fields tailored to the product + setup. + properties: + name: + type: optional + docs: Name of the Product + slug: + type: optional + docs: URL structure of the Product in your site. + description: + type: optional + docs: A description of your product + shippable: + type: optional + docs: Boolean determining if the Product is shippable + sku-properties: + type: optional> + docs: Variant types to include in SKUs + categories: + type: optional> + docs: The categories your product belongs to. + tax-category: + type: optional + docs: Product tax class + default-sku: + type: optional + docs: The default SKU associated with this product. + ec-product-type: + type: optional + docs: >- + Product + types. Enums reflect the following values in order: Physical, + Digital, Service, Advanced" + source: + openapi: ../../../referenced-specs/v2.yml + Product: + docs: The Product object + properties: + id: + type: optional + docs: Unique identifier for the Product + cmsLocaleId: + type: optional + docs: Identifier for the locale of the CMS item + lastPublished: + type: optional + docs: The date the Product was last published + lastUpdated: + type: optional + docs: The date the Product was last updated + createdOn: + type: optional + docs: The date the Product was created + isArchived: + type: optional + docs: Boolean determining if the Product is set to archived + default: false + isDraft: + type: optional + docs: Boolean determining if the Product is set to draft + default: false + fieldData: optional + source: + openapi: ../../../referenced-specs/v2.yml + SkuValueList: + type: map + docs: > + A dictionary that maps a SKU property to a SKU value. The key of the + dictionary is the SKU property ID, and the value is the SKU value ID. + SkuFieldDataPrice: + docs: price of SKU + properties: + value: + type: optional + docs: Price of SKU + unit: + type: optional + docs: Currency of Item + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + SkuFieldDataCompareAtPrice: + docs: comparison price of SKU + properties: + value: + type: optional + docs: Price of SKU + unit: + type: optional + docs: Currency of Item + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + SkuFieldDataEcSkuBillingMethod: + enum: + - value: one-time + name: OneTime + - subscription + source: + openapi: ../../../referenced-specs/v2.yml + SkuFieldDataEcSkuSubscriptionPlanInterval: + enum: + - day + - week + - month + - year + docs: Interval of subscription renewal + source: + openapi: ../../../referenced-specs/v2.yml + SkuFieldDataEcSkuSubscriptionPlanPlansItemStatus: + enum: + - active + - inactive + - canceled + docs: The status of the plan + source: + openapi: ../../../referenced-specs/v2.yml + SkuFieldDataEcSkuSubscriptionPlanPlansItem: + properties: + platform: + type: optional> + docs: The platform of the subscription plan + id: + type: optional + docs: The unique identifier of the plan + status: + type: optional + docs: The status of the plan + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + SkuFieldDataEcSkuSubscriptionPlan: + properties: + interval: + type: optional + docs: Interval of subscription renewal + frequency: + type: optional + docs: Frequncy of billing within interval + trial: + type: optional + docs: Number of days of a trial + plans: optional> + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + SkuFieldData: + docs: Standard and Custom fields for a SKU + properties: + sku-values: optional + name: + type: string + docs: Name of the Product + slug: + type: string + docs: URL structure of the Product in your site. + price: + type: SkuFieldDataPrice + docs: price of SKU + compare-at-price: + type: optional + docs: comparison price of SKU + ec-sku-billing-method: optional + ec-sku-subscription-plan: optional + track-inventory: + type: optional + docs: >- + A boolean indicating whether inventory for this product should be + tracked. + default: false + quantity: + type: optional + docs: Quantity of SKU that will be tracked as items are ordered. + source: + openapi: ../../../referenced-specs/v2.yml + Sku: + docs: The SKU object + properties: + id: + type: optional + docs: Unique identifier for the Product + cmsLocaleId: + type: optional + docs: Identifier for the locale of the CMS item + lastPublished: + type: optional + docs: The date the Product was last published + lastUpdated: + type: optional + docs: The date the Product was last updated + createdOn: + type: optional + docs: The date the Product was created + fieldData: optional + source: + openapi: ../../../referenced-specs/v2.yml + ProductAndSkUs: + docs: A product and its SKUs. + properties: + product: optional + skus: + type: optional> + docs: A list of SKU Objects + source: + openapi: ../../../referenced-specs/v2.yml + ProductAndSkUsList: + docs: Results from product list + properties: + items: + type: optional> + docs: >- + List of Item objects within the Collection. Contains product and skus + keys for each Item + pagination: optional + source: + openapi: ../../../referenced-specs/v2.yml + PublishStatus: + enum: + - staging + - live + docs: Indicate whether your Product should be set as "staging" or "live" + default: staging + source: + openapi: ../../../referenced-specs/v2.yml + OrderPrice: + properties: + unit: + type: optional + docs: The three-letter ISO currency code + value: + type: optional + docs: The numeric value in the base unit of the currency + string: + type: optional + docs: The user-facing string representation of the amount + source: + openapi: ../../../referenced-specs/v2.yml + OrderAddressType: + enum: + - shipping + - billing + docs: The type of the order address (billing or shipping) + source: + openapi: ../../../referenced-specs/v2.yml + OrderAddressJapanType: + enum: + - kana + - kanji + docs: >- + Represents a Japan-only address format. This field will only appear on + orders placed from Japan. + source: + openapi: ../../../referenced-specs/v2.yml + OrderAddress: + docs: A customer address + properties: + type: + type: optional + docs: The type of the order address (billing or shipping) + japanType: + type: optional + docs: >- + Represents a Japan-only address format. This field will only appear on + orders placed from Japan. + addressee: + type: optional + docs: Display name on the address + line1: + type: optional + docs: The first line of the address + line2: + type: optional + docs: The second line of the address + city: + type: optional + docs: The city of the address. + state: + type: optional + docs: The state or province of the address + country: + type: optional + docs: The country of the address + postalCode: + type: optional + docs: The postal code of the address + source: + openapi: ../../../referenced-specs/v2.yml + OrderPurchasedItemVariantImageFileVariantsItem: + properties: + url: + type: optional + docs: The hosted location for the Variant's image + validation: + format: uri + originalFileName: optional + size: + type: optional + docs: The image size in bytes + width: + type: optional + docs: The image width in pixels + height: + type: optional + docs: The image height in pixels + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + OrderPurchasedItemVariantImageFile: + properties: + size: + type: optional + docs: The image size in bytes + originalFileName: + type: optional + docs: the original name of the image + createdOn: + type: optional + docs: The creation timestamp of the image + contentType: + type: optional + docs: The MIME type of the image + width: + type: optional + docs: The image width in pixels + height: + type: optional + docs: The image height in pixels + variants: + type: optional> + docs: Variants of the supplied image + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + OrderPurchasedItemVariantImage: + properties: + url: + type: optional + docs: The hosted location for the Variant's image + validation: + format: uri + file: optional + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + OrderPurchasedItem: + docs: An Item that was purchased + properties: + count: + type: optional + docs: Number of Item purchased. + rowTotal: + type: optional + docs: The total for the row + productId: + type: optional + docs: The unique identifier for the Product + productName: + type: optional + docs: User-facing name of the Product + productSlug: + type: optional + docs: Slug for the Product + variantId: + type: optional + docs: Identifier for the Product Variant (SKU) + variantName: + type: optional + docs: User-facing name of the Product Variant (SKU) + variantSlug: + type: optional + docs: Slug for the Product Variant (SKU) + variantSKU: + type: optional + docs: The user-defined custom SKU of the Product Variant (SKU) + variantImage: optional + variantPrice: + type: optional + docs: The price corresponding to the variant + weight: + type: optional + docs: The physical weight of the variant if provided, or null + width: + type: optional + docs: The physical width of the variant if provided, or null + height: + type: optional + docs: The physical height of the variant if provided, or null + length: + type: optional + docs: The physical length of the variant if provided, or null + source: + openapi: ../../../referenced-specs/v2.yml + StripeDetails: + docs: >- + An object with various Stripe IDs, useful for linking into the stripe + dashboard. + properties: + subscriptionId: + type: optional + docs: Stripe-generated identifier for the Subscription + paymentMethod: + type: optional + docs: Stripe-generated identifier for the PaymentMethod used + paymentIntentId: + type: optional + docs: Stripe-generated identifier for the PaymentIntent, or null + customerId: + type: optional + docs: Stripe-generated customer identifier, or null + chargeId: + type: optional + docs: Stripe-generated charge identifier, or null + disputeId: + type: optional + docs: Stripe-generated dispute identifier, or null + refundId: + type: optional + docs: Stripe-generated refund identifier, or null + refundReason: + type: optional + docs: Stripe-generated refund reason, or null + source: + openapi: ../../../referenced-specs/v2.yml + StripeCardBrand: + enum: + - Visa + - value: American Express + name: AmericanExpress + - MasterCard + - Discover + - JCB + - value: Diners Club + name: DinersClub + - Unknown + docs: The card's brand (ie. credit card network) + source: + openapi: ../../../referenced-specs/v2.yml + StripeCardExpires: + docs: The card's expiration date. + properties: + year: + type: optional + docs: Year that the card expires + month: + type: optional + docs: Month that the card expires + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + StripeCard: + docs: > + Details on the card used to fulfill this order, if this order was + finalized with Stripe. + properties: + last4: + type: optional + docs: The last 4 digits on the card as a string + brand: + type: optional + docs: The card's brand (ie. credit card network) + ownerName: + type: optional + docs: The name on the card. + expires: + type: optional + docs: The card's expiration date. + source: + openapi: ../../../referenced-specs/v2.yml + PaypalDetails: + properties: + orderId: + type: optional + docs: PayPal order identifier + payerId: + type: optional + docs: PayPal payer identifier + captureId: + type: optional + docs: PayPal capture identifier + refundId: + type: optional + docs: PayPal refund identifier + refundReason: + type: optional + docs: PayPal-issued reason for the refund + disputeId: + type: optional + docs: PayPal dispute identifier + source: + openapi: ../../../referenced-specs/v2.yml + OrderStatus: + enum: + - pending + - unfulfilled + - fulfilled + - disputed + - value: dispute-lost + name: DisputeLost + - refunded + docs: | + The status of the Order + source: + openapi: ../../../referenced-specs/v2.yml + OrderDisputeLastStatus: + enum: + - warning_needs_response + - warning_under_review + - warning_closed + - needs_response + - under_review + - charge_refunded + - won + - lost + docs: > + If an order was disputed by the customer, then this key will be set with + the [dispute's status](https://stripe.com/docs/api#dispute_object-status). + source: + openapi: ../../../referenced-specs/v2.yml + OrderCustomerInfo: + docs: An object with the keys `fullName` and `email`. + properties: + fullName: + type: optional + docs: The full name of the Customer + email: + type: optional + docs: The Customer's email address + validation: + format: email + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + OrderMetadata: + properties: + isBuyNow: optional + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + OrderTotalsExtrasItemType: + enum: + - discount + - value: discount-shipping + name: DiscountShipping + - shipping + - tax + docs: The type of extra item this is. + source: + openapi: ../../../referenced-specs/v2.yml + OrderTotalsExtrasItem: + docs: Extra order items, includes discounts, shipping, and taxes. + properties: + type: + type: optional + docs: The type of extra item this is. + name: + type: optional + docs: A human-readable (but English) name for this extra charge. + description: + type: optional + docs: A human-readable (but English) description of this extra charge. + price: + type: optional + docs: The price for the item + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + OrderTotals: + docs: An object describing various pricing totals + properties: + subtotal: + type: optional + docs: The subtotal price + extras: + type: optional> + docs: An array of extra items, includes discounts, shipping, and taxes. + total: + type: optional + docs: The total price + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + OrderDownloadFilesItem: + properties: + id: + type: optional + docs: The unique identifier for the downloadable file + name: + type: optional + docs: The user-facing name for the downloadable file + url: + type: optional + docs: The hosted location for the downloadable file + validation: + format: uri + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + Order: + properties: + orderId: + type: optional + docs: | + The order ID. Will usually be 6 hex characters, but can also be 9 + hex characters if the site has a very large number of Orders. + Randomly assigned. + status: + type: optional + docs: | + The status of the Order + comment: + type: optional + docs: >- + A comment string for this Order, which is editable by API user (not + used by Webflow). + orderComment: + type: optional + docs: A comment that the customer left when making their Order + acceptedOn: + type: optional + docs: The ISO8601 timestamp that an Order was placed. + fulfilledOn: + type: optional + docs: > + When an Order is marked as 'fulfilled', this field represents the + timestamp of the fulfillment in ISO8601 format. Otherwise, it is null. + refundedOn: + type: optional + docs: >- + When an Order is marked as 'refunded', this field represents the + timestamp of the fulfillment in ISO8601 format. Otherwise, it is null. + disputedOn: + type: optional + docs: > + When an Order is marked as 'disputed', this field represents the + timestamp of the fulfillment in ISO8601 format. Otherwise, it is null. + disputeUpdatedOn: + type: optional + docs: > + If an Order has been disputed by the customer, this key will be set to + the ISO8601 timestamp of the last update received. If the Order is not + disputed, the key will be null. + disputeLastStatus: + type: optional + docs: > + If an order was disputed by the customer, then this key will be set + with the [dispute's + status](https://stripe.com/docs/api#dispute_object-status). + customerPaid: + type: optional + docs: The total paid by the customer + netAmount: + type: optional + docs: The net amount after application fees + applicationFee: + type: optional + docs: The application fee assessed by the platform + allAddresses: + type: optional> + docs: All addresses provided by the customer during the ordering flow. + shippingAddress: + type: optional + docs: The shipping address + billingAddress: + type: optional + docs: The billing address + shippingProvider: + type: optional + docs: > + A string editable by the API user to note the shipping provider used + (not used by Webflow). + shippingTracking: + type: optional + docs: > + A string editable by the API user to note the shipping tracking number + for the order (not used by Webflow). + shippingTrackingURL: + type: optional + validation: + format: uri + customerInfo: + type: optional + docs: An object with the keys `fullName` and `email`. + purchasedItems: + type: optional> + docs: An array of all things that the Customer purchased. + purchasedItemsCount: + type: optional + docs: The sum of all 'count' fields in 'purchasedItems'. + stripeDetails: optional + stripeCard: optional + paypalDetails: optional + customData: + type: optional>> + docs: > + An array of additional inputs for custom order data gathering. Each + object in the array represents an input with a name, and a textInput, + textArea, or checkbox value. + metadata: optional + isCustomerDeleted: + type: optional + docs: > + A boolean indicating whether the customer has been deleted from the + site. + isShippingRequired: + type: optional + docs: > + A boolean indicating whether the order contains one or more purchased + items that require shipping. + hasDownloads: + type: optional + docs: > + A boolean indicating whether the order contains one or more purchased + items that are downloadable. + paymentProcessor: + type: optional + docs: | + A string indicating the payment processor used for this order. + totals: + type: optional + docs: An object describing various pricing totals + downloadFiles: + type: optional> + docs: An array of downloadable file objects. + source: + openapi: ../../../referenced-specs/v2.yml + OrderList: + docs: Results from order list + properties: + orders: + type: optional> + docs: List of orders + pagination: optional + source: + openapi: ../../../referenced-specs/v2.yml + InventoryItemInventoryType: + enum: + - infinite + - finite + docs: infinite or finite + source: + openapi: ../../../referenced-specs/v2.yml + InventoryItem: + docs: The availabile inventory for an item + properties: + id: + type: optional + docs: Unique identifier for a SKU item + quantity: + type: optional + docs: >- + Total quantity of items remaining in inventory (if inventoryType is + finite) + inventoryType: + type: optional + docs: infinite or finite + source: + openapi: ../../../referenced-specs/v2.yml + EcommerceSettings: + docs: Ecommerce settings for a Webflow Site + properties: + siteId: + type: optional + docs: The identifier of the Site + createdOn: + type: optional + docs: Date that the Site was created on + defaultCurrency: + type: optional + docs: The three-letter ISO currency code for the Site + source: + openapi: ../../../referenced-specs/v2.yml diff --git a/.mock/definition/accessGroups.yml b/.mock/definition/accessGroups.yml new file mode 100644 index 0000000..662d2ed --- /dev/null +++ b/.mock/definition/accessGroups.yml @@ -0,0 +1,80 @@ +types: + AccessGroupsListRequestSort: + enum: + - value: CreatedOn + name: CreatedOnAscending + docs: Sorts users in ascending order based on their created date + - value: '-CreatedOn' + name: CreatedOnDescending + docs: Sorts users in descending order based on their created date + source: + openapi: ../../../referenced-specs/v2.yml +imports: + root: __package__.yml +service: + auth: false + base-path: '' + endpoints: + list: + path: /sites/{site_id}/accessgroups + method: GET + auth: true + docs: | + Get a list of access groups for a site + + Required scope | `users:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + display-name: List Access Groups + request: + name: AccessGroupsListRequest + query-parameters: + offset: + type: optional + docs: >- + Offset used for pagination if the results have more than limit + records + limit: + type: optional + docs: 'Maximum number of records to be returned (max limit: 100)' + sort: + type: optional + docs: | + Sort string to use when ordering access groups + Can be prefixed with a `-` to reverse the sort (ex. `-CreatedOn`) + response: + docs: Request was successful + type: root.AccessGroupList + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.ForbiddenError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + response: + body: + count: 1 + limit: 10 + offset: 0 + total: 1 + accessGroups: + - id: 62be58d404be8a6cc900c081 + name: Research Team + shortId: rt + slug: hitchhikers-guide-research-team + createdOn: '2022-08-01T19:41:48Z' + - id: 65a96161991e77bbb4a6c573 + name: Admin + shortId: ad + slug: admin + createdOn: '2022-08-01T19:41:48Z' + source: + openapi: ../../../referenced-specs/v2.yml diff --git a/.mock/definition/api.yml b/.mock/definition/api.yml new file mode 100644 index 0000000..aee9acd --- /dev/null +++ b/.mock/definition/api.yml @@ -0,0 +1,13 @@ +name: api +error-discrimination: + strategy: status-code +display-name: Data API +environments: + Default: https://api.webflow.com/v2 +default-environment: Default +auth-schemes: + BearerToken: + scheme: bearer + token: + name: accessToken +auth: BearerToken diff --git a/.mock/definition/assets.yml b/.mock/definition/assets.yml new file mode 100644 index 0000000..5614b78 --- /dev/null +++ b/.mock/definition/assets.yml @@ -0,0 +1,414 @@ +imports: + root: __package__.yml +service: + auth: false + base-path: '' + endpoints: + list: + path: /sites/{site_id}/assets + method: GET + auth: true + docs: | + List assets for a given site + + Required scope | `assets:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + display-name: List Assets + response: + docs: Request was successful + type: root.Assets + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + response: + body: + assets: + - id: 63e5889e7fe4eafa7384cea4 + contentType: image/png + size: 2212772 + siteId: 63938b302ea6b0aa6f3d8745 + hostedUrl: >- + https://s3.amazonaws.com/webflow-prod-assets/63938b302ea6b0aa6f3d8745/63e5889e7fe4eafa7384cea4_Vectors-Wrapper.svg + originalFileName: Candy-Wrapper.svg + displayName: 63e5889e7fe4eafa7384cea4_Candy-Wrapper.png + lastUpdated: '2023-03-01T23:42:57Z' + createdOn: '2023-02-09T23:58:22Z' + variants: + - hostedUrl: >- + https://s3.amazonaws.com/webflow-prod-assets/6258612d1ee792848f805dcf/660d83ce30f3a599ddb0bdb3_Screenshot%202024-03-20%20at%209.03.24%E2%80%AFPM-p-500.png + originalFileName: >- + Screenshot%202024-03-20%20at%209.03.24%E2%80%AFPM-p-500.png + displayName: >- + 660d83ce30f3a599ddb0bdb3_Screenshot%202024-03-20%20at%209.03.24%E2%80%AFPM-p-500.png + format: png + width: 500 + height: 900 + quality: 100 + altText: A red chair + create: + path: /sites/{site_id}/assets + method: POST + auth: true + docs: > + Create a new asset entry. + + + + This endpoint generates a response with the following information: + `uploadUrl` and `uploadDetails`. + + You can use these two properties to [upload the file to Amazon s3 by + making a + POST](https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPOST.html) + + request to the `uploadUrl` with the `uploadDetails` object as your + header information in the request. + + + Required scope | `assets:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + display-name: Create Asset Metadata + request: + name: AssetsCreateRequest + body: + properties: + fileName: + type: string + docs: >- + File name including file extension. File names must be less than + 100 characters. + fileHash: + type: string + docs: MD5 hash of the file + parentFolder: + type: optional + docs: ID of the Asset folder (optional) + content-type: application/json + response: + docs: Request was successful + type: root.AssetUpload + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + request: + fileName: file.png + fileHash: 3c7d87c9575702bc3b1e991f4d3c638e + response: + body: + uploadDetails: + acl: public-read + bucket: webflow-bucket-name + X-Amz-Algorithm: AWS4-HMAC-SHA256 + X-Amz-Credential: ///s3/aws4_request + X-Amz-Date: + key: /_ + Policy: + X-Amz-Signature: + success_action_status: '201' + content-type: image/png + Cache-Control: max-age=31536000, must-revalidate + contentType: image/png + id: 64358b9544249dc43d37d2b7 + parentFolder: 6436b1ce5281cace05b65aea + uploadUrl: >- + https://s3.amazonaws.com/webflow-dev-assets/643021114e290e0d3a0602b2/64358b9544249dc43d37d2b7_Screenshot%202023-04-11%20at%209.50.42%20AM.png + assetUrl: >- + https://s3.amazonaws.com/webflow-prod-assets/6258612d1ee792848f805dcf/660d907ab9e91e3e9f56385e_paranoidAndroid-2024.png + hostedUrl: >- + https://d1otoma47x30pg.cloudfront.net/643021114e290e0d3a0602b2/64358b9544249dc43d37d2b7_Screenshot%202023-04-11%20at%209.50.42%20AM.png + originalFileName: file.png + createdOn: '2023-04-11T16:32:21Z' + lastUpdated: '2023-04-12T20:31:03Z' + get: + path: /assets/{asset_id} + method: GET + auth: true + docs: | + Get an Asset + + Required scope | `assets:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + asset_id: + type: string + docs: Unique identifier for an Asset on a site + display-name: Get Asset + response: + docs: Request was successful + type: root.Asset + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + asset_id: 580e63fc8c9a982ac9b8b745 + response: + body: + id: 55131cd036c09f7d07883dfc + contentType: image/png + size: 1500 + siteId: 62749158efef318abc8d5a0f + hostedUrl: example.com/hostedimage.png + originalFileName: image.png + displayName: example-image-123.png + lastUpdated: '2016-09-06T21:12:22Z' + createdOn: '2016-09-02T23:26:22Z' + variants: + - hostedUrl: example.com/hostedimage.png + originalFileName: image.png + displayName: A brown dog + format: format + width: 1500 + height: 900 + quality: 1 + error: error + altText: A red chair + delete: + path: /assets/{asset_id} + method: DELETE + auth: true + docs: | + Delete an Asset + + Required Scope: `assets: write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + asset_id: + type: string + docs: Unique identifier for an Asset on a site + display-name: Delete Asset + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + asset_id: 580e63fc8c9a982ac9b8b745 + update: + path: /assets/{asset_id} + method: PATCH + auth: true + docs: | + Update an Asset + + Required scope | `assets:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + asset_id: + type: string + docs: Unique identifier for an Asset on a site + display-name: Update Asset + request: + name: AssetsUpdateRequest + body: + properties: + localeId: + type: optional + docs: >- + Unique identifier for a specific locale. Applicable, when using + localization. + displayName: + type: optional + docs: A human readable name for the asset + content-type: application/json + response: + docs: Request was successful + type: root.Asset + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + asset_id: 580e63fc8c9a982ac9b8b745 + request: {} + response: + body: + id: 55131cd036c09f7d07883dfc + contentType: image/png + size: 1500 + siteId: 62749158efef318abc8d5a0f + hostedUrl: example.com/hostedimage.png + originalFileName: image.png + displayName: example-image-123.png + lastUpdated: '2016-09-06T21:12:22Z' + createdOn: '2016-09-02T23:26:22Z' + variants: + - hostedUrl: example.com/hostedimage.png + originalFileName: image.png + displayName: A brown dog + format: format + width: 1500 + height: 900 + quality: 1 + error: error + altText: A red chair + list-folders: + path: /sites/{site_id}/asset_folders + method: GET + auth: true + docs: | + List Asset Folders within a given site + + Required scope | `assets:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + display-name: List Asset Folders + response: + docs: Request was successful + type: root.AssetFolderList + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + response: + body: + assetFolders: + - id: 6390c49774a71f0e3c1a08ee + displayName: emoji icons + parentFolder: 6390c49774a71f99f21a08eb + assets: + - 63e5889e7fe4eafa7384cea4 + - 659595234426a9fcbad57043 + siteId: 6390c49674a71f84b51a08d8 + createdOn: '2018-10-14T21:55:49Z' + lastUpdated: '2022-12-07T16:51:37Z' + pagination: + limit: 1 + offset: 0 + total: 1 + create-folder: + path: /sites/{site_id}/asset_folders + method: POST + auth: true + docs: | + Create an Asset Folder within a given site + + Required scope | `assets:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + display-name: Create Asset Folder + request: + name: AssetsCreateFolderRequest + body: + properties: + displayName: + type: string + docs: A human readable name for the Asset Folder + parentFolder: + type: optional + docs: >- + An (optional) pointer to a parent Asset Folder (or null for + root) + content-type: application/json + response: + docs: Request was successful + type: root.AssetFolder + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + request: + displayName: my asset folder + response: + body: + id: 6390c49774a71f0e3c1a08ee + displayName: emoji icons + parentFolder: 6390c49774a71f99f21a08eb + assets: + - 63e5889e7fe4eafa7384cea4 + - 659595234426a9fcbad57043 + siteId: 6390c49674a71f84b51a08d8 + createdOn: '2018-10-14T21:55:49Z' + lastUpdated: '2022-12-07T16:51:37Z' + get-folder: + path: /asset_folders/{asset_folder_id} + method: GET + auth: true + docs: | + Get details about a specific Asset Folder + + Required scope | `assets:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + asset_folder_id: + type: string + docs: Unique identifier for an Asset Folder + display-name: Get Asset Folder + response: + docs: Request was successful + type: root.AssetFolder + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + asset_folder_id: 6390c49774a71f0e3c1a08ee + response: + body: + id: 6390c49774a71f0e3c1a08ee + displayName: emoji icons + parentFolder: 6390c49774a71f99f21a08eb + assets: + - 63e5889e7fe4eafa7384cea4 + - 659595234426a9fcbad57043 + siteId: 6390c49674a71f84b51a08d8 + createdOn: '2018-10-14T21:55:49Z' + lastUpdated: '2022-12-07T16:51:37Z' + source: + openapi: ../../../referenced-specs/v2.yml + display-name: Assets diff --git a/.mock/definition/collections.yml b/.mock/definition/collections.yml new file mode 100644 index 0000000..a43baff --- /dev/null +++ b/.mock/definition/collections.yml @@ -0,0 +1,185 @@ +imports: + root: __package__.yml +service: + auth: false + base-path: '' + endpoints: + list: + path: /sites/{site_id}/collections + method: GET + auth: true + docs: | + List of all Collections within a Site. + + Required scope | `cms:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + display-name: List Collections + response: + docs: Request was successful + type: root.CollectionList + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + response: + body: + collections: + - id: 63692ab61fb2852f582ba8f5 + displayName: Products + singularName: Product + slug: product + createdOn: '2019-06-12T13:35:14Z' + lastUpdated: '2022-11-17T15:08:50Z' + - id: 63692ab61fb2856e6a2ba8f6 + displayName: Categories + singularName: Category + slug: category + createdOn: '2019-06-12T13:35:14Z' + lastUpdated: '2022-11-17T15:08:50Z' + - id: 63692ab61fb285a8562ba8f4 + displayName: SKUs + singularName: SKU + slug: sku + createdOn: '2019-06-12T13:35:14Z' + lastUpdated: '2022-11-17T15:08:50Z' + create: + path: /sites/{site_id}/collections + method: POST + auth: true + docs: | + Create a Collection for a site. + + Required scope | `cms:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + display-name: Create Collection + request: + name: CollectionsCreateRequest + body: + properties: + displayName: + type: string + docs: Name of the collection. Each collection name must be distinct. + singularName: + type: string + docs: Singular name of each item. + slug: + type: optional + docs: Part of a URL that identifier + content-type: application/json + response: + docs: Request was successful + type: root.Collection + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + request: + displayName: Blog Posts + singularName: Blog Post + slug: posts + response: + body: + id: 580e63fc8c9a982ac9b8b745 + displayName: Blog Posts + singularName: Blog Post + slug: post + createdOn: '2016-10-24T19:41:48Z' + lastUpdated: '2016-10-24T19:42:38Z' + fields: + - id: 23cc2d952d4e4631ffd4345d2743db4e + isRequired: true + isEditable: true + type: PlainText + slug: name + displayName: Name + helpText: helpText + get: + path: /collections/{collection_id} + method: GET + auth: true + docs: | + Get the full details of a collection from its ID. + + Required scope | `cms:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + collection_id: + type: string + docs: Unique identifier for a Collection + display-name: Get Collection Details + response: + docs: Request was successful + type: root.Collection + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + response: + body: + id: 580e63fc8c9a982ac9b8b745 + displayName: Blog Posts + singularName: Blog Post + slug: post + createdOn: '2016-10-24T19:41:48Z' + lastUpdated: '2016-10-24T19:42:38Z' + fields: + - id: 23cc2d952d4e4631ffd4345d2743db4e + isRequired: true + isEditable: true + type: PlainText + slug: name + displayName: Name + helpText: helpText + delete: + path: /collections/{collection_id} + method: DELETE + auth: true + docs: | + Delete a collection using its ID. + + Required scope | `cms:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + collection_id: + type: string + docs: Unique identifier for a Collection + display-name: Delete Collection + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + source: + openapi: ../../../referenced-specs/v2.yml + display-name: Collections diff --git a/.mock/definition/collections/fields.yml b/.mock/definition/collections/fields.yml new file mode 100644 index 0000000..210ebcc --- /dev/null +++ b/.mock/definition/collections/fields.yml @@ -0,0 +1,187 @@ +types: + FieldCreateType: + enum: + - PlainText + - RichText + - Image + - MultiImage + - Video + - Link + - Email + - Phone + - Number + - DateTime + - Switch + - Color + - File + docs: Choose these appropriate field type for your collection data + source: + openapi: ../../../referenced-specs/v2.yml +imports: + root: ../__package__.yml +service: + auth: false + base-path: '' + endpoints: + create: + path: /collections/{collection_id}/fields + method: POST + auth: true + docs: > + Create a custom field in a collection. + + + Slugs must be all lowercase letters without spaces. + + If you pass a string with uppercase letters and/or spaces to the "Slug" + property, Webflow will + + convert the slug to lowercase and replace spaces with "-." + + + Only some field types can be created through the API. + + This endpoint does not currently support bulk creation. + + + Required scope | `cms:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + collection_id: + type: string + docs: Unique identifier for a Collection + display-name: Create Collection Field + request: + name: FieldCreate + body: + properties: + isRequired: + type: optional + docs: define whether a field is required in a collection + type: + type: FieldCreateType + docs: Choose these appropriate field type for your collection data + displayName: + type: string + docs: The name of a field + helpText: + type: optional + docs: Additional text to help anyone filling out this field + content-type: application/json + response: + docs: Request was successful + type: root.Field + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + request: + isRequired: false + type: RichText + displayName: Post Body + helpText: Add the body of your post here + response: + body: + id: 75821f618da60c18383330bcc0ca488b + isRequired: false + isEditable: true + type: RichText + slug: post-body + displayName: Post Body + helpText: Add the body of your post here + delete: + path: /collections/{collection_id}/fields/{field_id} + method: DELETE + auth: true + docs: > + Delete a custom field in a collection. This endpoint does not currently + support bulk deletion. + + + Required scope | `cms:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + collection_id: + type: string + docs: Unique identifier for a Collection + field_id: + type: string + docs: Unique identifier for a Field in a collection + display-name: Delete Collection Field + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + field_id: 580e63fc8c9a982ac9b8b745 + update: + path: /collections/{collection_id}/fields/{field_id} + method: PATCH + auth: true + docs: | + Update a custom field in a collection. + + Required scope | `cms:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + collection_id: + type: string + docs: Unique identifier for a Collection + field_id: + type: string + docs: Unique identifier for a Field in a collection + display-name: Update Collection Field + request: + name: FieldUpdate + body: + properties: + isRequired: + type: optional + docs: Define whether a field is required in a collection + displayName: + type: optional + docs: The name of a field + helpText: + type: optional + docs: Additional text to help anyone filling out this field + content-type: application/json + response: + docs: Request was successful + type: root.Field + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + field_id: 580e63fc8c9a982ac9b8b745 + request: + isRequired: false + displayName: Post Body + helpText: Add the body of your post here + response: + body: + id: 75821f618da60c18383330bcc0ca488b + isRequired: false + isEditable: true + type: RichText + slug: post-body + displayName: Post Body + helpText: Add the body of your post here + source: + openapi: ../../../referenced-specs/v2.yml diff --git a/.mock/definition/collections/items.yml b/.mock/definition/collections/items.yml new file mode 100644 index 0000000..53c64e3 --- /dev/null +++ b/.mock/definition/collections/items.yml @@ -0,0 +1,1504 @@ +types: + ItemsListItemsRequestSortBy: + enum: + - lastPublished + - name + - slug + source: + openapi: ../../../referenced-specs/v2.yml + ItemsListItemsRequestSortOrder: + enum: + - asc + - desc + source: + openapi: ../../../referenced-specs/v2.yml + Multiple Items: + properties: + items: + type: optional> + docs: An array of items to create + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + ItemsCreateItemRequest: + discriminated: false + union: + - root.CollectionItemPostSingle + - Multiple Items + source: + openapi: ../../../referenced-specs/v2.yml + ItemsDeleteItemsRequestItemsItem: + properties: + id: + type: string + docs: Unique identifier for the Item + cmsLocaleIds: + type: optional> + docs: Array of identifiers for the locales where the item will be created + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + ItemsListItemsLiveRequestSortBy: + enum: + - lastPublished + - name + - slug + source: + openapi: ../../../referenced-specs/v2.yml + ItemsListItemsLiveRequestSortOrder: + enum: + - asc + - desc + source: + openapi: ../../../referenced-specs/v2.yml + Multiple Live Items: + properties: + items: + type: optional> + docs: List of collection items to create + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + ItemsCreateItemLiveRequest: + discriminated: false + union: + - root.CollectionItem + - Multiple Live Items + source: + openapi: ../../../referenced-specs/v2.yml + ItemsDeleteItemsLiveRequestItemsItem: + properties: + itemId: + type: string + docs: Unique identifier for the Item + cmsLocaleIds: + type: optional> + docs: Array of identifiers for the locales where the item will be created + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + Single CMS Item: + properties: + name: + type: string + docs: The name of the item. + slug: + type: string + docs: >- + URL slug for the item in your site. + + Note: Updating the item slug will break all links referencing the old + slug. + extra-properties: true + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + CreateBulkCollectionItemRequestBodyFieldDataItem: + docs: A single CMS item to create + properties: + name: + type: string + docs: The name of the item. + slug: + type: string + docs: >- + URL slug for the item in your site. + + Note: Updating the item slug will break all links referencing the old + slug. + extra-properties: true + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + CreateBulkCollectionItemRequestBodyFieldData: + discriminated: false + union: + - Single CMS Item + - docs: A list of CMS items to create + type: list + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + ItemsPublishItemResponse: + properties: + publishedItemIds: optional> + errors: optional> + source: + openapi: ../../../referenced-specs/v2.yml +imports: + root: ../__package__.yml +service: + auth: false + base-path: '' + endpoints: + list-items: + path: /collections/{collection_id}/items + method: GET + auth: true + docs: | + List of all Items within a Collection. + + Required scope | `CMS:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + collection_id: + type: string + docs: Unique identifier for a Collection + display-name: List Collection Items + request: + name: ItemsListItemsRequest + query-parameters: + cmsLocaleId: + type: optional + docs: >- + Unique identifier for a CMS Locale. This UID is different from the + Site locale identifier and is listed as `cmsLocaleId` in the Sites + response. To query multiple locales, input a comma separated + string. + offset: + type: optional + docs: >- + Offset used for pagination if the results have more than limit + records + limit: + type: optional + docs: 'Maximum number of records to be returned (max limit: 100)' + name: + type: optional + docs: The name of the item(s) + slug: + type: optional + docs: The slug of the item + sortBy: + type: optional + docs: Sort results by the provided value + sortOrder: + type: optional + docs: Sorts the results by asc or desc + response: + docs: Request was successful + type: root.CollectionItemList + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + response: + body: + items: + - id: 62b720ef280c7a7a3be8cabe + cmsLocaleId: 66f6e966c9e1dc700a857ca3 + lastPublished: '2022-06-30T13:35:20.878Z' + lastUpdated: '2022-06-25T14:51:27.809Z' + createdOn: '2022-06-25T14:51:27.809Z' + isArchived: false + isDraft: false + fieldData: + name: Senior Data Analyst + slug: senior-data-analyst + - id: 62c880ef281c7b7b4cf9dabc + cmsLocaleId: 66f6e966c9e1dc700a857ca3 + lastPublished: '2023-04-15T10:25:18.123Z' + lastUpdated: '2023-04-10T11:45:30.567Z' + createdOn: '2023-04-10T11:45:30.567Z' + isArchived: false + isDraft: false + fieldData: + name: Product Manager + slug: product-manager + pagination: + limit: 25 + offset: 0 + total: 2 + create-item: + path: /collections/{collection_id}/items + method: POST + auth: true + docs: > + Create Item(s) in a Collection. + + + + To create items across multiple locales, please use [this + endpoint.](/v2.0.0/data/reference/cms/collection-items/staged-items/create-items) + + + Required scope | `CMS:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + collection_id: + type: string + docs: Unique identifier for a Collection + display-name: Create Collection Item(s) + request: + body: ItemsCreateItemRequest + content-type: application/json + response: + docs: Request was successful + type: root.CollectionItem + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - name: SingleItem + path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + request: + isArchived: false + isDraft: false + fieldData: + name: Pan Galactic Gargle Blaster Recipe + slug: pan-galactic-gargle-blaster + response: + body: + id: 42b720ef280c7a7a3be8cabe + cmsLocaleId: 653ad57de882f528b32e810e + lastPublished: '2022-11-29T16:22:43.159Z' + lastUpdated: '2022-11-17T17:19:43.282Z' + createdOn: '2022-11-17T17:11:57.148Z' + isArchived: false + isDraft: false + fieldData: + name: Pan Galactic Gargle Blaster Recipe + slug: pan-galactic-gargle-blaster + - name: MultipleItems + path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + request: + items: + - isArchived: false + isDraft: false + fieldData: + name: Senior Data Analyst + slug: senior-data-analyst + - isArchived: false + isDraft: false + fieldData: + name: Product Manager + slug: product-manager + response: + body: + id: id + cmsLocaleId: 653ad57de882f528b32e810e + lastPublished: '2023-03-17T18:47:35.560Z' + lastUpdated: '2023-03-17T18:47:35.560Z' + createdOn: '2023-03-17T18:47:35.560Z' + isArchived: true + isDraft: true + fieldData: + name: My new item + slug: my-new-item + delete-items: + path: /collections/{collection_id}/items + method: DELETE + auth: true + docs: > + Delete Items from a Collection. + + + **Note:** If the `cmsLocaleId` parameter is undefined or empty and the + items are localized, items will be deleted only in the primary locale. + + + Required scope | `CMS:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + collection_id: + type: string + docs: Unique identifier for a Collection + display-name: Delete Collection Items + request: + name: ItemsDeleteItemsRequest + body: + properties: + items: optional> + content-type: application/json + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.ConflictError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + request: {} + update-items: + path: /collections/{collection_id}/items + method: PATCH + auth: true + docs: > + Update a single item or multiple items (up to 100) in a Collection. + + + **Note:** If the `cmsLocaleId` parameter is undefined or empty and the + items are localized, items will be updated only in the primary locale. + + + Required scope | `CMS:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + collection_id: + type: string + docs: Unique identifier for a Collection + display-name: Update Collection Items + request: + name: ItemsUpdateItemsRequest + body: + properties: + items: optional> + content-type: application/json + response: + docs: Request was successful + type: root.CollectionItem + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - name: LocalizedItems + path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + request: + items: + - id: 66f6ed9576ddacf3149d5ea6 + cmsLocaleId: 66f6e966c9e1dc700a857ca5 + fieldData: + name: Ne Paniquez Pas + slug: ne-paniquez-pas + - id: 66f6ed9576ddacf3149d5ea6 + cmsLocaleId: 66f6e966c9e1dc700a857ca4 + fieldData: + name: No Entrar en Pánico + slug: no-entrar-en-panico + - id: 66f6ed9576ddacf3149d5eaa + cmsLocaleId: 66f6e966c9e1dc700a857ca5 + fieldData: + name: Au Revoir et Merci pour Tous les Poissons + slug: au-revoir-et-merci + - id: 66f6ed9576ddacf3149d5eaa + cmsLocaleId: 66f6e966c9e1dc700a857ca4 + fieldData: + name: Hasta Luego y Gracias por Todo el Pescado + slug: hasta-luego-y-gracias + response: + body: + id: id + cmsLocaleId: 653ad57de882f528b32e810e + lastPublished: '2023-03-17T18:47:35.560Z' + lastUpdated: '2023-03-17T18:47:35.560Z' + createdOn: '2023-03-17T18:47:35.560Z' + isArchived: true + isDraft: true + fieldData: + name: My new item + slug: my-new-item + - name: MultipleItems + path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + request: + items: + - id: 580e64008c9a982ac9b8b754 + isArchived: false + isDraft: false + fieldData: + name: Senior Data Analyst + slug: senior-data-analyst + - id: 580e64008c9a982ac9b8b754 + isArchived: false + isDraft: false + fieldData: + name: Product Manager + slug: product-manager + response: + body: + id: id + cmsLocaleId: 653ad57de882f528b32e810e + lastPublished: '2023-03-17T18:47:35.560Z' + lastUpdated: '2023-03-17T18:47:35.560Z' + createdOn: '2023-03-17T18:47:35.560Z' + isArchived: true + isDraft: true + fieldData: + name: My new item + slug: my-new-item + - name: Multiple items updated across multiple locales + path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + request: + items: + - id: 66f6ed9576ddacf3149d5ea6 + cmsLocaleId: 66f6e966c9e1dc700a857ca5 + fieldData: + name: Ne Paniquez Pas + slug: ne-paniquez-pas + - id: 66f6ed9576ddacf3149d5ea6 + cmsLocaleId: 66f6e966c9e1dc700a857ca4 + fieldData: + name: No Entrar en Pánico + slug: no-entrar-en-panico + - id: 66f6ed9576ddacf3149d5eaa + cmsLocaleId: 66f6e966c9e1dc700a857ca5 + fieldData: + name: Au Revoir et Merci pour Tous les Poissons + slug: au-revoir-et-merci + - id: 66f6ed9576ddacf3149d5eaa + cmsLocaleId: 66f6e966c9e1dc700a857ca4 + fieldData: + name: Hasta Luego y Gracias por Todo el Pescado + slug: hasta-luego-y-gracias + response: + body: + id: id + cmsLocaleId: 653ad57de882f528b32e810e + lastPublished: '2023-03-17T18:47:35.560Z' + lastUpdated: '2023-03-17T18:47:35.560Z' + createdOn: '2023-03-17T18:47:35.560Z' + isArchived: true + isDraft: true + fieldData: + name: My new item + slug: my-new-item + - name: Mulitple items updated in a single locale + path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + request: + items: + - id: 66f6ed9576ddacf3149d5ea6 + cmsLocaleId: 66f6e966c9e1dc700a857ca5 + fieldData: + name: Ne Paniquez Pas + slug: ne-paniquez-pas + - id: 66f6ed9576ddacf3149d5ea6 + cmsLocaleId: 66f6e966c9e1dc700a857ca4 + fieldData: + name: No Entrar en Pánico + slug: no-entrar-en-panico + - id: 66f6ed9576ddacf3149d5eaa + cmsLocaleId: 66f6e966c9e1dc700a857ca5 + fieldData: + name: Au Revoir et Merci pour Tous les Poissons + slug: au-revoir-et-merci + - id: 66f6ed9576ddacf3149d5eaa + cmsLocaleId: 66f6e966c9e1dc700a857ca4 + fieldData: + name: Hasta Luego y Gracias por Todo el Pescado + slug: hasta-luego-y-gracias + response: + body: + id: id + cmsLocaleId: 653ad57de882f528b32e810e + lastPublished: '2023-03-17T18:47:35.560Z' + lastUpdated: '2023-03-17T18:47:35.560Z' + createdOn: '2023-03-17T18:47:35.560Z' + isArchived: true + isDraft: true + fieldData: + name: My new item + slug: my-new-item + list-items-live: + path: /collections/{collection_id}/items/live + method: GET + auth: true + docs: | + List of all live Items within a Collection. + + Required scope | `CMS:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + collection_id: + type: string + docs: Unique identifier for a Collection + display-name: List Live Collection Items + request: + name: ItemsListItemsLiveRequest + query-parameters: + cmsLocaleId: + type: optional + docs: >- + Unique identifier for a CMS Locale. This UID is different from the + Site locale identifier and is listed as `cmsLocaleId` in the Sites + response. To query multiple locales, input a comma separated + string. + offset: + type: optional + docs: >- + Offset used for pagination if the results have more than limit + records + limit: + type: optional + docs: 'Maximum number of records to be returned (max limit: 100)' + name: + type: optional + docs: The name of the item(s) + slug: + type: optional + docs: The slug of the item + sortBy: + type: optional + docs: Sort results by the provided value + sortOrder: + type: optional + docs: Sorts the results by asc or desc + response: + docs: Request was successful + type: root.CollectionItemList + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + response: + body: + items: + - id: 62b720ef280c7a7a3be8cabe + cmsLocaleId: 66f6e966c9e1dc700a857ca3 + lastPublished: '2022-06-30T13:35:20.878Z' + lastUpdated: '2022-06-25T14:51:27.809Z' + createdOn: '2022-06-25T14:51:27.809Z' + isArchived: false + isDraft: false + fieldData: + name: Senior Data Analyst + slug: senior-data-analyst + - id: 62c880ef281c7b7b4cf9dabc + cmsLocaleId: 66f6e966c9e1dc700a857ca3 + lastPublished: '2023-04-15T10:25:18.123Z' + lastUpdated: '2023-04-10T11:45:30.567Z' + createdOn: '2023-04-10T11:45:30.567Z' + isArchived: false + isDraft: false + fieldData: + name: Product Manager + slug: product-manager + pagination: + limit: 25 + offset: 0 + total: 2 + create-item-live: + path: /collections/{collection_id}/items/live + method: POST + auth: true + docs: > + Create live Item(s) in a Collection. The Item(s) will be published to + the live site. + + + + To create items across multiple locales, [please use this + endpoint.](/v2.0.0/data/reference/cms/collection-items/staged-items/create-items) + + + + Required scope | `CMS:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + collection_id: + type: string + docs: Unique identifier for a Collection + display-name: Create Live Collection Item(s) + request: + body: ItemsCreateItemLiveRequest + content-type: application/json + response: + docs: Request was successful + type: root.CollectionItem + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - name: SingleItem + path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + request: + isArchived: false + isDraft: false + fieldData: + name: Pan Galactic Gargle Blaster Recipe + slug: pan-galactic-gargle-blaster + response: + body: + id: 42b720ef280c7a7a3be8cabe + cmsLocaleId: 653ad57de882f528b32e810e + lastPublished: '2022-11-29T16:22:43.159Z' + lastUpdated: '2022-11-17T17:19:43.282Z' + createdOn: '2022-11-17T17:11:57.148Z' + isArchived: false + isDraft: false + fieldData: + name: Pan Galactic Gargle Blaster Recipe + slug: pan-galactic-gargle-blaster + - name: MultipleItems + path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + request: + items: + - isArchived: false + isDraft: false + fieldData: + name: Senior Data Analyst + slug: senior-data-analyst + - isArchived: false + isDraft: false + fieldData: + name: Product Manager + slug: product-manager + response: + body: + id: 42b720ef280c7a7a3be8cabe + cmsLocaleId: 653ad57de882f528b32e810e + lastPublished: '2022-11-29T16:22:43.159Z' + lastUpdated: '2022-11-17T17:19:43.282Z' + createdOn: '2022-11-17T17:11:57.148Z' + isArchived: false + isDraft: false + fieldData: + name: Pan Galactic Gargle Blaster Recipe + slug: pan-galactic-gargle-blaster + delete-items-live: + path: /collections/{collection_id}/items/live + method: DELETE + auth: true + docs: > + Remove an item or multiple items (up to 100 items) from the live site. + Deleting published items will unpublish the items from the live site and + set them to draft. + + + **Note:** If the `cmsLocaleId` parameter is undefined or empty and the + items are localized, items will be unpublished only in the primary + locale. + + + Required scope | `CMS:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + collection_id: + type: string + docs: Unique identifier for a Collection + display-name: Delete Live Collection Items + request: + name: ItemsDeleteItemsLiveRequest + body: + properties: + items: optional> + content-type: application/json + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + request: {} + update-items-live: + path: /collections/{collection_id}/items/live + method: PATCH + auth: true + docs: > + Update a single live item or multiple live items (up to 100) in a + Collection + + + **Note:** If the `cmsLocaleId` parameter is undefined or empty and the + items are localized, items will be updated only in the primary locale. + + + Required scope | `CMS:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + collection_id: + type: string + docs: Unique identifier for a Collection + display-name: Update Live Collection Items + request: + name: ItemsUpdateItemsLiveRequest + body: + properties: + items: optional> + content-type: application/json + response: + docs: Request was successful + type: root.CollectionItemListNoPagination + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - name: LocalizedItems + path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + request: + items: + - id: 66f6ed9576ddacf3149d5ea6 + cmsLocaleId: 66f6e966c9e1dc700a857ca5 + fieldData: + name: Ne Paniquez Pas + slug: ne-paniquez-pas + - id: 66f6ed9576ddacf3149d5ea6 + cmsLocaleId: 66f6e966c9e1dc700a857ca4 + fieldData: + name: No Entrar en Pánico + slug: no-entrar-en-panico + - id: 66f6ed9576ddacf3149d5eaa + cmsLocaleId: 66f6e966c9e1dc700a857ca5 + fieldData: + name: Au Revoir et Merci pour Tous les Poissons + slug: au-revoir-et-merci + - id: 66f6ed9576ddacf3149d5eaa + cmsLocaleId: 66f6e966c9e1dc700a857ca4 + fieldData: + name: Hasta Luego y Gracias por Todo el Pescado + slug: hasta-luego-y-gracias + response: + body: + items: + - id: 66f6ed9576ddacf3149d5ea6 + cmsLocaleId: 66f6e966c9e1dc700a857ca5 + lastPublished: '2023-03-17T18:47:35.560Z' + lastUpdated: '2024-09-27T17:38:29.066Z' + createdOn: '2024-09-27T17:38:29.066Z' + isArchived: true + isDraft: true + fieldData: + name: Ne Paniquez Pas + slug: ne-paniquez-pas + - id: 66f6ed9576ddacf3149d5ea6 + cmsLocaleId: 66f6e966c9e1dc700a857ca4 + lastPublished: '2023-03-17T18:47:35.560Z' + lastUpdated: '2024-09-27T17:38:29.066Z' + createdOn: '2024-09-27T17:38:29.066Z' + isArchived: true + isDraft: true + fieldData: + name: No Entrar en Pánico + slug: no-entrar-en-panico + - id: 66f6ed9576ddacf3149d5eaa + cmsLocaleId: 66f6e966c9e1dc700a857ca5 + lastPublished: '2023-03-17T18:47:35.560Z' + lastUpdated: '2024-09-27T17:38:29.066Z' + createdOn: '2024-09-27T17:38:29.066Z' + isArchived: true + isDraft: true + fieldData: + name: Au Revoir et Merci pour Tous les Poissons + slug: au-revoir-et-merci + - id: 66f6ed9576ddacf3149d5eaa + cmsLocaleId: 66f6e966c9e1dc700a857ca4 + lastPublished: '2023-03-17T18:47:35.560Z' + lastUpdated: '2024-09-27T17:38:29.066Z' + createdOn: '2024-09-27T17:38:29.066Z' + isArchived: true + isDraft: true + fieldData: + name: Hasta Luego y Gracias por Todo el Pescado + slug: hasta-luego-y-gracias + - name: MultipleItems + path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + request: + items: + - id: 580e64008c9a982ac9b8b754 + isArchived: false + isDraft: false + fieldData: + name: Senior Data Analyst + slug: senior-data-analyst + - id: 580e64008c9a982ac9b8b754 + isArchived: false + isDraft: false + fieldData: + name: Product Manager + slug: product-manager + response: + body: + items: + - id: 66f6ed9576ddacf3149d5ea6 + cmsLocaleId: 66f6e966c9e1dc700a857ca5 + lastPublished: '2023-03-17T18:47:35.560Z' + lastUpdated: '2024-09-27T17:38:29.066Z' + createdOn: '2024-09-27T17:38:29.066Z' + isArchived: true + isDraft: true + fieldData: + name: Ne Paniquez Pas + slug: ne-paniquez-pas + - id: 66f6ed9576ddacf3149d5ea6 + cmsLocaleId: 66f6e966c9e1dc700a857ca4 + lastPublished: '2023-03-17T18:47:35.560Z' + lastUpdated: '2024-09-27T17:38:29.066Z' + createdOn: '2024-09-27T17:38:29.066Z' + isArchived: true + isDraft: true + fieldData: + name: No Entrar en Pánico + slug: no-entrar-en-panico + - id: 66f6ed9576ddacf3149d5eaa + cmsLocaleId: 66f6e966c9e1dc700a857ca5 + lastPublished: '2023-03-17T18:47:35.560Z' + lastUpdated: '2024-09-27T17:38:29.066Z' + createdOn: '2024-09-27T17:38:29.066Z' + isArchived: true + isDraft: true + fieldData: + name: Au Revoir et Merci pour Tous les Poissons + slug: au-revoir-et-merci + - id: 66f6ed9576ddacf3149d5eaa + cmsLocaleId: 66f6e966c9e1dc700a857ca4 + lastPublished: '2023-03-17T18:47:35.560Z' + lastUpdated: '2024-09-27T17:38:29.066Z' + createdOn: '2024-09-27T17:38:29.066Z' + isArchived: true + isDraft: true + fieldData: + name: Hasta Luego y Gracias por Todo el Pescado + slug: hasta-luego-y-gracias + - name: Multiple items updated across multiple locales + path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + request: + items: + - id: 66f6ed9576ddacf3149d5ea6 + cmsLocaleId: 66f6e966c9e1dc700a857ca5 + fieldData: + name: Ne Paniquez Pas + slug: ne-paniquez-pas + - id: 66f6ed9576ddacf3149d5ea6 + cmsLocaleId: 66f6e966c9e1dc700a857ca4 + fieldData: + name: No Entrar en Pánico + slug: no-entrar-en-panico + - id: 66f6ed9576ddacf3149d5eaa + cmsLocaleId: 66f6e966c9e1dc700a857ca5 + fieldData: + name: Au Revoir et Merci pour Tous les Poissons + slug: au-revoir-et-merci + - id: 66f6ed9576ddacf3149d5eaa + cmsLocaleId: 66f6e966c9e1dc700a857ca4 + fieldData: + name: Hasta Luego y Gracias por Todo el Pescado + slug: hasta-luego-y-gracias + response: + body: + items: + - id: 66f6ed9576ddacf3149d5ea6 + cmsLocaleId: 66f6e966c9e1dc700a857ca5 + lastPublished: '2023-03-17T18:47:35.560Z' + lastUpdated: '2024-09-27T17:38:29.066Z' + createdOn: '2024-09-27T17:38:29.066Z' + isArchived: true + isDraft: true + fieldData: + name: Ne Paniquez Pas + slug: ne-paniquez-pas + - id: 66f6ed9576ddacf3149d5ea6 + cmsLocaleId: 66f6e966c9e1dc700a857ca4 + lastPublished: '2023-03-17T18:47:35.560Z' + lastUpdated: '2024-09-27T17:38:29.066Z' + createdOn: '2024-09-27T17:38:29.066Z' + isArchived: true + isDraft: true + fieldData: + name: No Entrar en Pánico + slug: no-entrar-en-panico + - id: 66f6ed9576ddacf3149d5eaa + cmsLocaleId: 66f6e966c9e1dc700a857ca5 + lastPublished: '2023-03-17T18:47:35.560Z' + lastUpdated: '2024-09-27T17:38:29.066Z' + createdOn: '2024-09-27T17:38:29.066Z' + isArchived: true + isDraft: true + fieldData: + name: Au Revoir et Merci pour Tous les Poissons + slug: au-revoir-et-merci + - id: 66f6ed9576ddacf3149d5eaa + cmsLocaleId: 66f6e966c9e1dc700a857ca4 + lastPublished: '2023-03-17T18:47:35.560Z' + lastUpdated: '2024-09-27T17:38:29.066Z' + createdOn: '2024-09-27T17:38:29.066Z' + isArchived: true + isDraft: true + fieldData: + name: Hasta Luego y Gracias por Todo el Pescado + slug: hasta-luego-y-gracias + - name: Mulitple items updated in a single locale + path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + request: + items: + - id: 66f6ed9576ddacf3149d5ea6 + cmsLocaleId: 66f6e966c9e1dc700a857ca5 + fieldData: + name: Ne Paniquez Pas + slug: ne-paniquez-pas + - id: 66f6ed9576ddacf3149d5ea6 + cmsLocaleId: 66f6e966c9e1dc700a857ca4 + fieldData: + name: No Entrar en Pánico + slug: no-entrar-en-panico + - id: 66f6ed9576ddacf3149d5eaa + cmsLocaleId: 66f6e966c9e1dc700a857ca5 + fieldData: + name: Au Revoir et Merci pour Tous les Poissons + slug: au-revoir-et-merci + - id: 66f6ed9576ddacf3149d5eaa + cmsLocaleId: 66f6e966c9e1dc700a857ca4 + fieldData: + name: Hasta Luego y Gracias por Todo el Pescado + slug: hasta-luego-y-gracias + response: + body: + items: + - id: 62b720ef280c7a7a3be8cabe + cmsLocaleId: 66f6e966c9e1dc700a857ca3 + lastPublished: '2022-06-30T13:35:20.878Z' + lastUpdated: '2022-06-25T14:51:27.809Z' + createdOn: '2022-06-25T14:51:27.809Z' + isArchived: false + isDraft: false + fieldData: + name: Senior Data Analyst + slug: senior-data-analyst + - id: 62c880ef281c7b7b4cf9dabc + cmsLocaleId: 66f6e966c9e1dc700a857ca3 + lastPublished: '2023-04-15T10:25:18.123Z' + lastUpdated: '2023-04-10T11:45:30.567Z' + createdOn: '2023-04-10T11:45:30.567Z' + isArchived: false + isDraft: false + fieldData: + name: Product Manager + slug: product-manager + create-items: + path: /collections/{collection_id}/items/bulk + method: POST + auth: true + docs: > + Create an item or multiple items in a CMS Collection across multiple + corresponding locales. + + + **Notes:** + - This endpoint can create up to 100 items in a request. + - If the `cmsLocaleIds` parameter is undefined or empty and localization is enabled, items will only be created in the primary locale. + + Required scope | `CMS:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + collection_id: + type: string + docs: Unique identifier for a Collection + display-name: Create Collection Items + request: + name: CreateBulkCollectionItemRequestBody + body: + properties: + cmsLocaleIds: + type: optional> + docs: >- + Array of identifiers for the locales where the item will be + created + isArchived: + type: optional + docs: Indicates whether the item is archived. + default: false + isDraft: + type: optional + docs: Indicates whether the item is in draft state. + default: false + fieldData: CreateBulkCollectionItemRequestBodyFieldData + content-type: application/json + response: + docs: Request was successful + type: root.BulkCollectionItem + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - name: Create a single item across multiple locales + path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + request: + cmsLocaleIds: + - 66f6e966c9e1dc700a857ca3 + - 66f6e966c9e1dc700a857ca4 + - 66f6e966c9e1dc700a857ca5 + isArchived: false + isDraft: false + fieldData: + name: Don’t Panic + slug: dont-panic + response: + body: + id: 580e64008c9a982ac9b8b754 + cmsLocaleIds: + - 653ad57de882f528b32e810e + - 6514390aea353fc691d69827 + - 65143930ea353fc691d69cd8 + lastPublished: '2023-03-17T18:47:35.560Z' + lastUpdated: '2023-03-17T18:47:35.560Z' + createdOn: '2023-03-17T18:47:35.560Z' + isArchived: true + isDraft: true + fieldData: + name: My new item + slug: my-new-item + - name: Create multiple items across multipel locales + path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + request: + cmsLocaleIds: + - 66f6e966c9e1dc700a857ca3 + - 66f6e966c9e1dc700a857ca4 + isArchived: false + isDraft: false + fieldData: + - name: Don’t Panic + slug: dont-panic + - name: So Long and Thanks for All the Fish + slug: so-long-and-thanks + response: + body: + id: 580e64008c9a982ac9b8b754 + cmsLocaleIds: + - 653ad57de882f528b32e810e + - 6514390aea353fc691d69827 + - 65143930ea353fc691d69cd8 + lastPublished: '2023-03-17T18:47:35.560Z' + lastUpdated: '2023-03-17T18:47:35.560Z' + createdOn: '2023-03-17T18:47:35.560Z' + isArchived: true + isDraft: true + fieldData: + name: My new item + slug: my-new-item + - name: Single item created across multiple locales + path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + request: + cmsLocaleIds: + - 66f6e966c9e1dc700a857ca3 + - 66f6e966c9e1dc700a857ca4 + - 66f6e966c9e1dc700a857ca5 + isArchived: false + isDraft: false + fieldData: + name: Don’t Panic + slug: dont-panic + response: + body: + id: 580e64008c9a982ac9b8b754 + cmsLocaleIds: + - 653ad57de882f528b32e810e + - 6514390aea353fc691d69827 + - 65143930ea353fc691d69cd8 + lastPublished: '2023-03-17T18:47:35.560Z' + lastUpdated: '2023-03-17T18:47:35.560Z' + createdOn: '2023-03-17T18:47:35.560Z' + isArchived: true + isDraft: true + fieldData: + name: My new item + slug: my-new-item + - name: Multiple items created across multiple locales + path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + request: + cmsLocaleIds: + - 66f6e966c9e1dc700a857ca3 + - 66f6e966c9e1dc700a857ca4 + - 66f6e966c9e1dc700a857ca5 + isArchived: false + isDraft: false + fieldData: + name: Don’t Panic + slug: dont-panic + response: + body: + id: 580e64008c9a982ac9b8b754 + cmsLocaleIds: + - 653ad57de882f528b32e810e + - 6514390aea353fc691d69827 + - 65143930ea353fc691d69cd8 + lastPublished: '2023-03-17T18:47:35.560Z' + lastUpdated: '2023-03-17T18:47:35.560Z' + createdOn: '2023-03-17T18:47:35.560Z' + isArchived: true + isDraft: true + fieldData: + name: My new item + slug: my-new-item + get-item: + path: /collections/{collection_id}/items/{item_id} + method: GET + auth: true + docs: | + Get details of a selected Collection Item. + + Required scope | `CMS:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + collection_id: + type: string + docs: Unique identifier for a Collection + item_id: + type: string + docs: Unique identifier for an Item + display-name: Get Collection Item + request: + name: ItemsGetItemRequest + query-parameters: + cmsLocaleId: + type: optional + docs: >- + Unique identifier for a CMS Locale. This UID is different from the + Site locale identifier and is listed as `cmsLocaleId` in the Sites + response. To query multiple locales, input a comma separated + string. + response: + docs: Request was successful + type: root.CollectionItem + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + item_id: 580e64008c9a982ac9b8b754 + response: + body: + id: 42b720ef280c7a7a3be8cabe + cmsLocaleId: 653ad57de882f528b32e810e + lastPublished: '2022-11-29T16:22:43.159Z' + lastUpdated: '2022-11-17T17:19:43.282Z' + createdOn: '2022-11-17T17:11:57.148Z' + isArchived: false + isDraft: false + fieldData: + name: Pan Galactic Gargle Blaster Recipe + slug: pan-galactic-gargle-blaster + delete-item: + path: /collections/{collection_id}/items/{item_id} + method: DELETE + auth: true + docs: > + Delete an Item from a Collection. This endpoint does not currently + support bulk deletion. + + + Required scope | `CMS:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + collection_id: + type: string + docs: Unique identifier for a Collection + item_id: + type: string + docs: Unique identifier for an Item + display-name: Delete Collection Item + request: + name: ItemsDeleteItemRequest + query-parameters: + cmsLocaleId: + type: optional + docs: >- + Unique identifier for a CMS Locale. This UID is different from the + Site locale identifier and is listed as `cmsLocaleId` in the Sites + response. To query multiple locales, input a comma separated + string. + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + item_id: 580e64008c9a982ac9b8b754 + update-item: + path: /collections/{collection_id}/items/{item_id} + method: PATCH + auth: true + docs: | + Update a selected Item in a Collection. + + Required scope | `CMS:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + collection_id: + type: string + docs: Unique identifier for a Collection + item_id: + type: string + docs: Unique identifier for an Item + display-name: Update Collection Item + request: + body: root.CollectionItemPatchSingle + content-type: application/json + response: + docs: Request was successful + type: root.CollectionItem + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + item_id: 580e64008c9a982ac9b8b754 + request: + isArchived: false + isDraft: false + fieldData: + name: Pan Galactic Gargle Blaster Recipe + slug: pan-galactic-gargle-blaster + response: + body: + id: 42b720ef280c7a7a3be8cabe + cmsLocaleId: 653ad57de882f528b32e810e + lastPublished: '2022-11-29T16:22:43.159Z' + lastUpdated: '2022-11-17T17:19:43.282Z' + createdOn: '2022-11-17T17:11:57.148Z' + isArchived: false + isDraft: false + fieldData: + name: Pan Galactic Gargle Blaster Recipe + slug: pan-galactic-gargle-blaster + get-item-live: + path: /collections/{collection_id}/items/{item_id}/live + method: GET + auth: true + docs: | + Get details of a selected Collection live Item. + + Required scope | `CMS:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + collection_id: + type: string + docs: Unique identifier for a Collection + item_id: + type: string + docs: Unique identifier for an Item + display-name: Get Live Collection Item + request: + name: ItemsGetItemLiveRequest + query-parameters: + cmsLocaleId: + type: optional + docs: >- + Unique identifier for a CMS Locale. This UID is different from the + Site locale identifier and is listed as `cmsLocaleId` in the Sites + response. To query multiple locales, input a comma separated + string. + response: + docs: Request was successful + type: root.CollectionItem + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + item_id: 580e64008c9a982ac9b8b754 + response: + body: + id: 42b720ef280c7a7a3be8cabe + cmsLocaleId: 653ad57de882f528b32e810e + lastPublished: '2022-11-29T16:22:43.159Z' + lastUpdated: '2022-11-17T17:19:43.282Z' + createdOn: '2022-11-17T17:11:57.148Z' + isArchived: false + isDraft: false + fieldData: + name: Pan Galactic Gargle Blaster Recipe + slug: pan-galactic-gargle-blaster + delete-item-live: + path: /collections/{collection_id}/items/{item_id}/live + method: DELETE + auth: true + docs: > + Remove a live item from the site. Removing a published item will + unpublish the item from the live site and set it to draft. + + + This endpoint does not currently support bulk deletion. + + + Required scope | `CMS:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + collection_id: + type: string + docs: Unique identifier for a Collection + item_id: + type: string + docs: Unique identifier for an Item + display-name: Delete Live Collection Item + request: + name: ItemsDeleteItemLiveRequest + query-parameters: + cmsLocaleId: + type: optional + docs: >- + Unique identifier for a CMS Locale. This UID is different from the + Site locale identifier and is listed as `cmsLocaleId` in the Sites + response. To query multiple locales, input a comma separated + string. + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + item_id: 580e64008c9a982ac9b8b754 + update-item-live: + path: /collections/{collection_id}/items/{item_id}/live + method: PATCH + auth: true + docs: > + Update a selected live Item in a Collection. The updates for this Item + will be published to the live site. + + + Required scope | `CMS:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + collection_id: + type: string + docs: Unique identifier for a Collection + item_id: + type: string + docs: Unique identifier for an Item + display-name: Update Live Collection Item + request: + body: root.CollectionItemPatchSingle + content-type: application/json + response: + docs: Request was successful + type: root.CollectionItem + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + item_id: 580e64008c9a982ac9b8b754 + request: + isArchived: false + isDraft: false + fieldData: + name: Pan Galactic Gargle Blaster Recipe + slug: pan-galactic-gargle-blaster + response: + body: + id: 42b720ef280c7a7a3be8cabe + cmsLocaleId: 653ad57de882f528b32e810e + lastPublished: '2022-11-29T16:22:43.159Z' + lastUpdated: '2022-11-17T17:19:43.282Z' + createdOn: '2022-11-17T17:11:57.148Z' + isArchived: false + isDraft: false + fieldData: + name: Pan Galactic Gargle Blaster Recipe + slug: pan-galactic-gargle-blaster + publish-item: + path: /collections/{collection_id}/items/publish + method: POST + auth: true + docs: | + Publish an item or multiple items. + + Required scope | `cms:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + collection_id: + type: string + docs: Unique identifier for a Collection + display-name: Publish Collection Item + request: + name: ItemsPublishItemRequest + body: + properties: + itemIds: list + content-type: application/json + response: + docs: Request was successful + type: ItemsPublishItemResponse + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.ConflictError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + request: + itemIds: + - itemIds + response: + body: + publishedItemIds: + - 643fd856d66b6528195ee2ca + - 643fd856d66b6528195ee2cb + errors: + - Staging item ID 643fd856d66b6528195ee2cf not found. + source: + openapi: ../../../referenced-specs/v2.yml diff --git a/.mock/definition/ecommerce.yml b/.mock/definition/ecommerce.yml new file mode 100644 index 0000000..29529a2 --- /dev/null +++ b/.mock/definition/ecommerce.yml @@ -0,0 +1,42 @@ +imports: + root: __package__.yml +service: + auth: false + base-path: '' + endpoints: + get-settings: + path: /sites/{site_id}/ecommerce/settings + method: GET + auth: true + docs: | + Retrieve ecommerce settings for a site. + + Required scope | `ecommerce:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + display-name: Get Ecommerce Settings + response: + docs: Request was successful + type: root.EcommerceSettings + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.ForbiddenError + - root.NotFoundError + - root.ConflictError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + response: + body: + siteId: 5eb0b5583bf24e2d3a488969 + createdOn: '2018-10-04T15:21:02Z' + defaultCurrency: USD + source: + openapi: ../../../referenced-specs/v2.yml diff --git a/.mock/definition/forms.yml b/.mock/definition/forms.yml new file mode 100644 index 0000000..fad8637 --- /dev/null +++ b/.mock/definition/forms.yml @@ -0,0 +1,301 @@ +imports: + root: __package__.yml +service: + auth: false + base-path: '' + endpoints: + list: + path: /sites/{site_id}/forms + method: GET + auth: true + docs: | + List forms for a given site. + + Required scope | `forms:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + display-name: List Forms + request: + name: FormsListRequest + query-parameters: + limit: + type: optional + docs: 'Maximum number of records to be returned (max limit: 100)' + offset: + type: optional + docs: >- + Offset used for pagination if the results have more than limit + records + response: + docs: Request was successful + type: root.FormList + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.ForbiddenError + - root.NotFoundError + - root.ConflictError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + response: + body: + forms: + - displayName: Email Form + createdOn: '2016-10-24T19:41:29Z' + lastUpdated: '2016-10-24T19:43:17Z' + fields: + '0': + displayName: Email + userVisible: true + '1': + displayName: Email + userVisible: true + responseSettings: + redirectUrl: https://example.com + redirectMethod: GET + sendEmailConfirmation: true + id: 589a331aa51e760df7ccb89e + siteId: 580e63e98c9a982ac9b8b741 + siteDomainId: 6419db964a9c436a4baf6248 + pageId: 6419db964a9c43f6a3af6348 + pageName: Home + formElementId: 4e038d2c-6a1e-4953-7be9-a59a2b453177 + workspaceId: 580e63fc8c9a982ac9b8b744 + - displayName: Name Form + createdOn: '2016-10-24T19:41:29Z' + lastUpdated: '2016-10-24T19:43:17Z' + fields: + '0': + displayName: Email + userVisible: true + responseSettings: + redirectUrl: https://example.com + redirectMethod: GET + sendEmailConfirmation: false + id: 580ff8d7ba3e45ba9fe588e9 + siteId: 580e63e98c9a982ac9b8b741 + siteDomainId: 6419db964a9c436a4baf6248 + pageId: 6419db964a9c43f6a3af6348 + pageName: Home + formElementId: 4e038d2c-6a1e-4953-7be9-a59a2b453177 + workspaceId: 580e63fc8c9a982ac9b8b744 + pagination: + limit: 25 + offset: 0 + total: 2 + get: + path: /forms/{form_id} + method: GET + auth: true + docs: | + Get information about a given form. + + Required scope | `forms:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + form_id: + type: string + docs: Unique identifier for a Form + display-name: Get Form Schema + response: + docs: Request was successful + type: root.Form + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.ForbiddenError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + form_id: 580e63e98c9a982ac9b8b741 + response: + body: + displayName: Email Form + createdOn: '2016-10-24T19:41:29Z' + lastUpdated: '2016-10-24T19:43:17Z' + fields: + 660d5bcc9c0772150459dfb1: + displayName: Name + type: Plain + placeholder: Enter your email + userVisible: true + 589a331aa51e760df7ccb89d: + displayName: Email + type: Email + placeholder: Enter your email + userVisible: true + responseSettings: + redirectUrl: https://example.com + redirectMethod: GET + redirectAction: POST https://example.com + sendEmailConfirmation: true + id: 589a331aa51e760df7ccb89e + siteId: 580e63e98c9a982ac9b8b741 + siteDomainId: 6419db964a9c436a4baf6248 + pageId: 6419db964a9c43f6a3af6348 + pageName: Home + formElementId: 4e038d2c-6a1e-4953-7be9-a59a2b453177 + workspaceId: 580e63fc8c9a982ac9b8b744 + list-submissions: + path: /forms/{form_id}/submissions + method: GET + auth: true + docs: | + List form submissions for a given form + + Required scope | `forms:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + form_id: + type: string + docs: Unique identifier for a Form + display-name: List Form Submissions + request: + name: FormsListSubmissionsRequest + query-parameters: + offset: + type: optional + docs: >- + Offset used for pagination if the results have more than limit + records + limit: + type: optional + docs: 'Maximum number of records to be returned (max limit: 100)' + response: + docs: Request was successful + type: root.FormSubmissionList + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.ForbiddenError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + form_id: 580e63e98c9a982ac9b8b741 + response: + body: + formSubmissions: + - id: 6321ca84df3949bfc6752327 + displayName: Sample Form + siteId: 62749158efef318abc8d5a0f + workspaceId: 62749158efef318abc8d5a0f + dateSubmitted: '2022-09-14T12:35:16Z' + formResponse: + First Name: Arthur + Last Name: Dent + - id: 660d64fabf6e0a0d4edab981 + displayName: Sample Form + siteId: 62749158efef318abc8d5a0f + workspaceId: 62749158efef318abc8d5a0f + dateSubmitted: '2022-09-14T12:35:16Z' + formResponse: + First Name: Ford + Last Name: Prefect + pagination: + limit: 25 + offset: 0 + total: 2 + get-submission: + path: /form_submissions/{form_submission_id} + method: GET + auth: true + docs: | + Get information about a given form submissio. + + Required scope | `forms:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + form_submission_id: + type: string + docs: Unique identifier for a Form Submission + display-name: Get Form Submission + response: + docs: Request was successful + type: root.FormSubmission + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.ForbiddenError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + form_submission_id: 580e63e98c9a982ac9b8b741 + response: + body: + id: 6321ca84df3949bfc6752327 + displayName: Sample Form + siteId: 62749158efef318abc8d5a0f + workspaceId: 62749158efef318abc8d5a0f + dateSubmitted: '2022-09-14T12:35:16Z' + formResponse: + First Name: Arthur + Last Name: Dent + update-submission: + path: /form_submissions/{form_submission_id} + method: PATCH + auth: true + docs: | + Update hidden fields on a form submission + + Required scope | `forms:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + form_submission_id: + type: string + docs: Unique identifier for a Form Submission + display-name: Modify Form Submission + request: + name: FormsUpdateSubmissionRequest + body: + properties: + formSubmissionData: + type: optional> + docs: >- + An existing **hidden field** defined on the form schema, and the + corresponding value to set + content-type: application/json + response: + docs: Request was successful + type: root.FormSubmission + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.ForbiddenError + - root.NotFoundError + - root.ConflictError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + form_submission_id: 580e63e98c9a982ac9b8b741 + request: {} + response: + body: + id: 6321ca84df3949bfc6752327 + displayName: Sample Form + siteId: 62749158efef318abc8d5a0f + workspaceId: 62749158efef318abc8d5a0f + dateSubmitted: '2022-09-14T12:35:16Z' + formResponse: + First Name: Arthur + Last Name: Dent + source: + openapi: ../../../referenced-specs/v2.yml + display-name: Forms diff --git a/.mock/definition/inventory.yml b/.mock/definition/inventory.yml new file mode 100644 index 0000000..14bd5c0 --- /dev/null +++ b/.mock/definition/inventory.yml @@ -0,0 +1,120 @@ +imports: + root: __package__.yml +service: + auth: false + base-path: '' + endpoints: + list: + path: /collections/{collection_id}/items/{item_id}/inventory + method: GET + auth: true + docs: | + List the current inventory levels for a particular SKU item. + + Required scope | `ecommerce:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + collection_id: + type: string + docs: Unique identifier for a Collection + item_id: + type: string + docs: Unique identifier for an Item + display-name: List Inventory + response: + docs: Request was successful + type: root.InventoryItem + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.ForbiddenError + - root.NotFoundError + - root.ConflictError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + item_id: 580e64008c9a982ac9b8b754 + response: + body: + id: 5bfedb42bab0ad90fa7dad39 + quantity: 100 + inventoryType: finite + update: + path: /collections/{collection_id}/items/{item_id}/inventory + method: PATCH + auth: true + docs: > + Updates the current inventory levels for a particular SKU item. + + + Updates may be given in one or two methods, absolutely or + incrementally. + + - Absolute updates are done by setting `quantity` directly. + + - Incremental updates are by specifying the inventory delta in + `updateQuantity` which is then added to the `quantity` stored on the + server. + + + Required scope | `ecommerce:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + collection_id: + type: string + docs: Unique identifier for a Collection + item_id: + type: string + docs: Unique identifier for an Item + display-name: Update Item Inventory + request: + name: InventoryUpdateRequest + body: + properties: + inventoryType: + type: InventoryUpdateRequestInventoryType + docs: infinite or finite + updateQuantity: + type: optional + docs: Adds this quantity to currently store quantity. Can be negative. + quantity: + type: optional + docs: Immediately sets quantity to this value. + content-type: application/json + response: + docs: Request was successful + type: root.InventoryItem + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.ForbiddenError + - root.NotFoundError + - root.ConflictError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + collection_id: 580e63fc8c9a982ac9b8b745 + item_id: 580e64008c9a982ac9b8b754 + request: + inventoryType: infinite + response: + body: + id: 5bfedb42bab0ad90fa7dad39 + quantity: 100 + inventoryType: finite + source: + openapi: ../../../referenced-specs/v2.yml + display-name: Inventory +types: + InventoryUpdateRequestInventoryType: + enum: + - infinite + - finite + docs: infinite or finite + source: + openapi: ../../../referenced-specs/v2.yml diff --git a/.mock/definition/orders.yml b/.mock/definition/orders.yml new file mode 100644 index 0000000..75be222 --- /dev/null +++ b/.mock/definition/orders.yml @@ -0,0 +1,1569 @@ +types: + OrdersListRequestStatus: + enum: + - pending + - refunded + - value: dispute-lost + name: DisputeLost + - fulfilled + - disputed + - unfulfilled + source: + openapi: ../../../referenced-specs/v2.yml + OrdersRefundRequestReason: + enum: + - duplicate + - fraudulent + - requested + docs: The reason for the refund + source: + openapi: ../../../referenced-specs/v2.yml +imports: + root: __package__.yml +service: + auth: false + base-path: '' + endpoints: + list: + path: /sites/{site_id}/orders + method: GET + auth: true + docs: | + List all orders created for a given site. + + Required scope | `ecommerce:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + display-name: List Orders + request: + name: OrdersListRequest + query-parameters: + status: + type: optional + docs: Filter the orders by status + offset: + type: optional + docs: >- + Offset used for pagination if the results have more than limit + records + limit: + type: optional + docs: 'Maximum number of records to be returned (max limit: 100)' + response: + docs: Request was successful + type: root.OrderList + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.ForbiddenError + - root.NotFoundError + - root.ConflictError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + response: + body: + orders: + - orderId: 7c1-9fd + status: unfulfilled + comment: >- + Customer requested gift wrapping and a personalized note + saying: Happy Birthday, Ford! 🎉 Please ensure the item is + packed with extra bubble wrap for safe transit. + orderComment: >- + Please gift wrap with a personal note saying "Happy + Birthday, Ford! 🎉 + acceptedOn: '2024-04-10T13:16:21Z' + fulfilledOn: '2018-12-03T22:06:15Z' + refundedOn: '2018-12-03T22:06:15Z' + disputedOn: '2018-12-03T22:06:15Z' + disputeUpdatedOn: '2018-12-03T22:06:15Z' + disputeLastStatus: warning_needs_response + customerPaid: + unit: USD + value: '5892' + string: ' 211.55 USD' + netAmount: + unit: USD + value: '5892' + string: ' 200.89 USD' + applicationFee: + unit: USD + value: '5892' + string: ' 4.23 USD' + allAddresses: + - type: billing + addressee: Arthur Dent + line1: 20 W 34th St + line2: Empire State Building + city: New York + state: New York + country: US + postalCode: '10118' + - type: shipping + addressee: Arthur Dent + line1: 20 W 34th St + line2: Empire State Building + city: New York + state: New York + country: US + postalCode: '10118' + shippingAddress: + type: shipping + japanType: kanji + addressee: Arthur Dent + line1: 20 W 34th St + line2: Empire State Building + city: New York + state: New York + country: US + postalCode: '10118' + billingAddress: + type: billing + addressee: Arthur Dent + line1: 20 W 34th St + line2: Empire State Building + city: New York + state: New York + country: US + postalCode: '10118' + shippingProvider: Shipping Company, Co. + shippingTracking: tr00000000002 + shippingTrackingURL: https://www.shippingcompany.com/tracking/tr00000000002 + customerInfo: + fullName: Arthur Dent + email: arthur.dent@example.com + purchasedItems: + - count: 2 + rowTotal: + unit: USD + value: '5892' + string: ' 111.22 USD' + productId: 66072fb61b89448912e26791 + productName: Luxurious Fresh Ball + productSlug: luxurious-fresh-ball + variantId: 66072fb71b89448912e2683f + variantName: 'Luxurious Fresh Ball Generic: Bronze, Practical: Plastic' + variantSlug: luxurious-fresh-ball-generic-bronze-practical-plastic + variantSKU: luxurious-fresh-ball-generic-bronze-practical-plastic + variantImage: + url: >- + https://d1otoma47x30pg.cloudfront.net/66072f39417a2a35b2589cc7/66072fb51b89448912e2672c_image14.jpeg + variantPrice: + unit: USD + value: '5892' + string: ' 55.61 USD' + weight: 11 + width: 82 + height: 70 + length: 9 + - count: 1 + rowTotal: + unit: USD + value: '5892' + string: ' 83.09 USD' + productId: 66072fb61b89448912e2678b + productName: Incredible Bronze Towels + productSlug: incredible-bronze-towels + variantId: 66072fb71b89448912e2681e + variantName: >- + Incredible Bronze Towels Sleek: Frozen, Incredible: + Metal + variantSlug: incredible-bronze-towels-sleek-frozen-incredible-metal + variantSKU: incredible-bronze-towels-sleek-frozen-incredible-metal + variantImage: + url: >- + https://d1otoma47x30pg.cloudfront.net/66072f39417a2a35b2589cc7/66072fb51b89448912e26729_image16.jpeg + variantPrice: + unit: USD + value: '5892' + string: ' 83.09 USD' + width: 19 + height: 72 + length: 18 + purchasedItemsCount: 3 + stripeDetails: + paymentMethod: pm_1P410gJYFi4lcbXWbeKghqjK + paymentIntentId: pi_3P410iJYFi4lcbXW0EKKgcVg + customerId: cus_Ptod8KJBiiPgnH + chargeId: ch_3P410iJYFi4lcbXW0DxUkzCH + stripeCard: + last4: '4242' + brand: Visa + ownerName: Arthur Dent + expires: + year: 2025 + month: 4 + paypalDetails: + orderId: 1a2b3c4d5e6f7g8h9i0j + payerId: 9k8j7i6h5g4f3e2d1c0b + captureId: qwe123rty456uio789p + refundId: abcde12345fghij67890 + refundReason: Customer requested refund + disputeId: zxcvbnm987poiuytrewq + customData: + - key: value + metadata: + isBuyNow: false + isCustomerDeleted: false + isShippingRequired: false + hasDownloads: false + paymentProcessor: stripe + totals: + extras: + - type: tax + name: State Taxes + description: CA Taxes (6.25%) + price: + unit: USD + value: '5892' + string: '3.44' + downloadFiles: + - id: 5e9a5eba75e0ac242e1b6f64 + name: The modern web design process - Webflow Ebook.pdf + url: >- + https://webflow.com/dashboard/download-digital-product?payload=5d93ba5e38c6b0160ab711d3;e7634a;5eb1aac72912ec06f561278c;5e9a5eba75e0ac242e1b6f63:ka2nehxy:4a1ee0a632feaab94294350087215ed89533f2f530903e3b933b638940e921aa + - orderId: fc7-128 + status: refunded + comment: Example comment to myself + orderComment: '' + acceptedOn: '2024-03-29T21:29:21Z' + fulfilledOn: '2018-12-03T22:06:15Z' + refundedOn: '2024-04-08T18:25:04Z' + disputedOn: '2018-12-03T22:06:15Z' + disputeUpdatedOn: '2018-12-03T22:06:15Z' + disputeLastStatus: warning_needs_response + customerPaid: + unit: USD + value: '5892' + string: ' 118.73 USD' + netAmount: + unit: USD + value: '5892' + string: ' 112.62 USD' + applicationFee: + unit: USD + value: '5892' + string: ' 2.37 USD' + allAddresses: + - type: billing + addressee: Arthur Dent + line1: 20 W 34th St + line2: Empire State Building + city: New York + state: New York + country: US + postalCode: '10118' + - type: shipping + addressee: Arthur Dent + line1: 20 W 34th St + line2: Empire State Building + city: New York + state: New York + country: US + postalCode: '10118' + shippingAddress: + type: shipping + addressee: Arthur Dent + line1: 20 W 34th St + line2: Empire State Building + city: New York + state: New York + country: US + postalCode: '10118' + billingAddress: + type: billing + addressee: Arthur Dent + line1: 20 W 34th St + line2: Empire State Building + city: New York + state: New York + country: US + postalCode: '10118' + shippingProvider: Shipping Company, Co. + shippingTracking: tr00000000001 + shippingTrackingURL: https://www.shippingcompany.com/tracking/tr00000000001 + customerInfo: + fullName: Arthur Dent + email: arthur.dent@example.com + purchasedItems: + - count: 1 + rowTotal: + unit: USD + value: '5892' + string: ' 55.61 USD' + productId: 66072fb61b89448912e26791 + productName: Luxurious Fresh Ball + productSlug: luxurious-fresh-ball + variantId: 66072fb71b89448912e2683f + variantName: 'Luxurious Fresh Ball Generic: Bronze, Practical: Plastic' + variantSlug: luxurious-fresh-ball-generic-bronze-practical-plastic + variantSKU: luxurious-fresh-ball-generic-bronze-practical-plastic + variantImage: + url: >- + https://d1otoma47x30pg.cloudfront.net/66072f39417a2a35b2589cc7/66072fb51b89448912e2672c_image14.jpeg + variantPrice: + unit: USD + value: '5892' + string: ' 55.61 USD' + weight: 11 + width: 82 + height: 70 + length: 9 + - count: 1 + rowTotal: + unit: USD + value: '5892' + string: ' 53.44 USD' + productId: 66072fb61b89448912e26799 + productName: Recycled Steel Gloves + productSlug: recycled-steel-gloves + variantId: 66072fb91b89448912e26ab9 + variantName: >- + Recycled Steel Gloves Electronic: Granite, Handcrafted: + grey + variantSlug: >- + recycled-steel-gloves-electronic-granite-handcrafted-grey + variantSKU: >- + recycled-steel-gloves-electronic-granite-handcrafted-grey + variantImage: + url: >- + https://d1otoma47x30pg.cloudfront.net/66072f39417a2a35b2589cc7/66072fb51b89448912e2671e_image2.jpeg + variantPrice: + unit: USD + value: '5892' + string: ' 53.44 USD' + weight: 38 + width: 76 + height: 85 + length: 40 + purchasedItemsCount: 2 + stripeDetails: + paymentMethod: pm_1OzmzBJYFi4lcbXWHKNdXU7j + paymentIntentId: pi_3OzmzDJYFi4lcbXW1hTBW6ft + customerId: cus_PpRsNHwWdUoRKR + chargeId: ch_3OzmzDJYFi4lcbXW1ndkkrH2 + refundId: re_3OzmzDJYFi4lcbXW1kFAmlBk + refundReason: fraudulent + stripeCard: + last4: '4242' + brand: Visa + ownerName: Arthur Dent + expires: + year: 2024 + month: 4 + paypalDetails: + orderId: 1a2b3c4d5e6f7g8h9i0j + payerId: 9k8j7i6h5g4f3e2d1c0b + captureId: qwe123rty456uio789p + refundId: abcde12345fghij67890 + refundReason: Customer requested refund + disputeId: zxcvbnm987poiuytrewq + customData: + - key: value + metadata: + isBuyNow: false + isCustomerDeleted: false + isShippingRequired: true + hasDownloads: false + paymentProcessor: stripe + totals: + subtotal: + unit: USD + value: '5892' + string: ' 109.05 USD' + extras: + - type: tax + name: State Taxes + description: NY Taxes (4.00%) + price: + unit: USD + value: '5892' + string: ' 4.36 USD' + - type: tax + name: City Taxes + description: NEW YORK Taxes (4.88%) + price: + unit: USD + value: '5892' + string: ' 5.32 USD' + - type: shipping + name: Flat + description: '' + price: + unit: USD + value: '5892' + string: ' 0.00 USD' + total: + unit: USD + value: '5892' + string: ' 118.73 USD' + downloadFiles: + - id: 5e9a5eba75e0ac242e1b6f64 + name: New product guide + url: >- + https://webflow.com/dashboard/download-digital-product?payload=5d93ba5e38c6b0160ab711d3;e7634a;5eb1aac72912ec06f561278c;5e9a5eba75e0ac242e1b6f63:ka2nehxy:4a1ee0a632feaab94294350087215ed89533f2f530903e3b933b638940e921aa + pagination: + limit: 100 + offset: 0 + total: 2 + get: + path: /sites/{site_id}/orders/{order_id} + method: GET + auth: true + docs: | + Retrieve a single product by its ID. All of its SKUs will also be + retrieved. + + Required scope | `ecommerce:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + order_id: + type: string + docs: Unique identifier for an Order + display-name: Get Order + response: + docs: Request was successful + type: root.Order + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.ForbiddenError + - root.NotFoundError + - root.ConflictError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + order_id: 5e8518516e147040726cc415 + response: + body: + orderId: fc7-128 + status: refunded + comment: >- + Customer requested gift wrapping and a personalized note saying: + Happy Birthday, Ford! 🎉 Please ensure the item is packed with + extra bubble wrap for safe transit. + orderComment: >- + Please gift wrap with a personal note saying "Happy Birthday, + Ford! 🎉 + acceptedOn: '2024-03-29T21:29:21Z' + fulfilledOn: '2024-03-29T21:29:21Z' + refundedOn: '2024-04-08T18:25:04Z' + disputedOn: '2024-03-29T21:29:21Z' + disputeUpdatedOn: '2024-03-29T21:29:21Z' + disputeLastStatus: charge_refunded + customerPaid: + unit: USD + value: '5892' + string: ' 118.73 USD' + netAmount: + unit: USD + value: '5892' + string: ' 112.62 USD' + applicationFee: + unit: USD + value: '5892' + string: ' 2.37 USD' + allAddresses: + - type: billing + japanType: kana + addressee: Arthur Dent + line1: 20 W 34th St + line2: Empire State Building + city: New York + state: New York + country: US + postalCode: '10118' + - type: shipping + japanType: kana + addressee: Arthur Dent + line1: 20 W 34th St + line2: Empire State Building + city: New York + state: New York + country: US + postalCode: '10118' + shippingAddress: + type: shipping + japanType: kanji + addressee: Arthur Dent + line1: 20 W 34th St + line2: Empire State Building + city: New York + state: New York + country: US + postalCode: '10118' + billingAddress: + type: billing + japanType: kana + addressee: Arthur Dent + line1: 20 W 34th St + line2: Empire State Building + city: New York + state: New York + country: US + postalCode: '10118' + shippingProvider: Shipping Company, Co. + shippingTracking: tr00000000001 + shippingTrackingURL: https://www.shippingcompany.com/tracking/tr00000000001 + customerInfo: + fullName: Arthur Dent + email: arthur.dent@example.com + purchasedItems: + - count: 1 + rowTotal: + unit: USD + value: '5892' + string: ' 55.61 USD' + productId: 66072fb61b89448912e26791 + productName: Luxurious Fresh Ball + productSlug: luxurious-fresh-ball + variantId: 66072fb71b89448912e2683f + variantName: 'Luxurious Fresh Ball Generic: Bronze, Practical: Plastic' + variantSlug: luxurious-fresh-ball-generic-bronze-practical-plastic + variantSKU: luxurious-fresh-ball-generic-bronze-practical-plastic + variantImage: + url: >- + https://d1otoma47x30pg.cloudfront.net/66072f39417a2a35b2589cc7/66072fb51b89448912e2672c_image14.jpeg + variantPrice: + unit: USD + value: '5892' + string: ' 55.61 USD' + weight: 11 + width: 82 + height: 70 + length: 9 + - count: 1 + rowTotal: + unit: USD + value: '5892' + string: ' 53.44 USD' + productId: 66072fb61b89448912e26799 + productName: Recycled Steel Gloves + productSlug: recycled-steel-gloves + variantId: 66072fb91b89448912e26ab9 + variantName: 'Recycled Steel Gloves Electronic: Granite, Handcrafted: grey' + variantSlug: recycled-steel-gloves-electronic-granite-handcrafted-grey + variantSKU: recycled-steel-gloves-electronic-granite-handcrafted-grey + variantImage: + url: >- + https://d1otoma47x30pg.cloudfront.net/66072f39417a2a35b2589cc7/66072fb51b89448912e2671e_image2.jpeg + variantPrice: + unit: USD + value: '5892' + string: ' 53.44 USD' + weight: 38 + width: 76 + height: 85 + length: 40 + purchasedItemsCount: 2 + stripeDetails: + subscriptionId: sub_1J6xwG2eZvKYlo2CXu9Zt0Tn + paymentMethod: pm_1OzmzBJYFi4lcbXWHKNdXU7j + paymentIntentId: pi_3OzmzDJYFi4lcbXW1hTBW6ft + customerId: cus_PpRsNHwWdUoRKR + chargeId: ch_3OzmzDJYFi4lcbXW1ndkkrH2 + disputeId: disputeId + refundId: re_3OzmzDJYFi4lcbXW1kFAmlBk + refundReason: fraudulent + stripeCard: + last4: '4242' + brand: Visa + ownerName: Arthur Dent + expires: + year: 2024 + month: 4 + paypalDetails: + orderId: 1a2b3c4d5e6f7g8h9i0j + payerId: 9k8j7i6h5g4f3e2d1c0b + captureId: qwe123rty456uio789p + refundId: abcde12345fghij67890 + refundReason: Customer requested refund + disputeId: zxcvbnm987poiuytrewq + customData: + - key: value + metadata: + isBuyNow: false + isCustomerDeleted: false + isShippingRequired: true + hasDownloads: false + paymentProcessor: stripe + totals: + subtotal: + unit: USD + value: '5892' + string: ' 109.05 USD' + extras: + - type: tax + name: State Taxes + description: NY Taxes (4.00%) + price: + unit: USD + value: '5892' + string: ' 4.36 USD' + - type: tax + name: City Taxes + description: NEW YORK Taxes (4.88%) + price: + unit: USD + value: '5892' + string: ' 5.32 USD' + - type: shipping + name: Flat + description: '' + price: + unit: USD + value: '5892' + string: ' 0.00 USD' + total: + unit: USD + value: '5892' + string: ' 118.73 USD' + downloadFiles: + - id: 5e9a5eba75e0ac242e1b6f64 + name: New product guide + url: >- + https://webflow.com/dashboard/download-digital-product?payload=5d93ba5e38c6b0160ab711d3;e7634a;5eb1aac72912ec06f561278c;5e9a5eba75e0ac242e1b6f63:ka2nehxy:4a1ee0a632feaab94294350087215ed89533f2f530903e3b933b638940e921aa + update: + path: /sites/{site_id}/orders/{order_id} + method: PATCH + auth: true + docs: | + This API lets you update the fields, `comment`, `shippingProvider`, + and/or `shippingTracking` for a given order. All three fields can be + updated simultaneously or independently. + + Required scope | `ecommerce:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + order_id: + type: string + docs: Unique identifier for an Order + display-name: Update Order + request: + name: OrdersUpdateRequest + body: + properties: + comment: + type: optional + docs: Arbitrary data for your records + shippingProvider: + type: optional + docs: Company or method used to ship order + shippingTracking: + type: optional + docs: Tracking number for order shipment + shippingTrackingURL: + type: optional + docs: URL to track order shipment + content-type: application/json + response: + docs: Request was successful + type: root.Order + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.ForbiddenError + - root.NotFoundError + - root.ConflictError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + order_id: 5e8518516e147040726cc415 + request: {} + response: + body: + orderId: fc7-128 + status: refunded + comment: >- + Customer requested gift wrapping and a personalized note saying: + Happy Birthday, Ford! 🎉 Please ensure the item is packed with + extra bubble wrap for safe transit. + orderComment: >- + Please gift wrap with a personal note saying "Happy Birthday, + Ford! 🎉 + acceptedOn: '2024-03-29T21:29:21Z' + fulfilledOn: '2024-03-29T21:29:21Z' + refundedOn: '2024-04-08T18:25:04Z' + disputedOn: '2024-03-29T21:29:21Z' + disputeUpdatedOn: '2024-03-29T21:29:21Z' + disputeLastStatus: charge_refunded + customerPaid: + unit: USD + value: '5892' + string: ' 118.73 USD' + netAmount: + unit: USD + value: '5892' + string: ' 112.62 USD' + applicationFee: + unit: USD + value: '5892' + string: ' 2.37 USD' + allAddresses: + - type: billing + japanType: kana + addressee: Arthur Dent + line1: 20 W 34th St + line2: Empire State Building + city: New York + state: New York + country: US + postalCode: '10118' + - type: shipping + japanType: kana + addressee: Arthur Dent + line1: 20 W 34th St + line2: Empire State Building + city: New York + state: New York + country: US + postalCode: '10118' + shippingAddress: + type: shipping + japanType: kanji + addressee: Arthur Dent + line1: 20 W 34th St + line2: Empire State Building + city: New York + state: New York + country: US + postalCode: '10118' + billingAddress: + type: billing + japanType: kana + addressee: Arthur Dent + line1: 20 W 34th St + line2: Empire State Building + city: New York + state: New York + country: US + postalCode: '10118' + shippingProvider: Shipping Company, Co. + shippingTracking: tr00000000001 + shippingTrackingURL: https://www.shippingcompany.com/tracking/tr00000000001 + customerInfo: + fullName: Arthur Dent + email: arthur.dent@example.com + purchasedItems: + - count: 1 + rowTotal: + unit: USD + value: '5892' + string: ' 55.61 USD' + productId: 66072fb61b89448912e26791 + productName: Luxurious Fresh Ball + productSlug: luxurious-fresh-ball + variantId: 66072fb71b89448912e2683f + variantName: 'Luxurious Fresh Ball Generic: Bronze, Practical: Plastic' + variantSlug: luxurious-fresh-ball-generic-bronze-practical-plastic + variantSKU: luxurious-fresh-ball-generic-bronze-practical-plastic + variantImage: + url: >- + https://d1otoma47x30pg.cloudfront.net/66072f39417a2a35b2589cc7/66072fb51b89448912e2672c_image14.jpeg + variantPrice: + unit: USD + value: '5892' + string: ' 55.61 USD' + weight: 11 + width: 82 + height: 70 + length: 9 + - count: 1 + rowTotal: + unit: USD + value: '5892' + string: ' 53.44 USD' + productId: 66072fb61b89448912e26799 + productName: Recycled Steel Gloves + productSlug: recycled-steel-gloves + variantId: 66072fb91b89448912e26ab9 + variantName: 'Recycled Steel Gloves Electronic: Granite, Handcrafted: grey' + variantSlug: recycled-steel-gloves-electronic-granite-handcrafted-grey + variantSKU: recycled-steel-gloves-electronic-granite-handcrafted-grey + variantImage: + url: >- + https://d1otoma47x30pg.cloudfront.net/66072f39417a2a35b2589cc7/66072fb51b89448912e2671e_image2.jpeg + variantPrice: + unit: USD + value: '5892' + string: ' 53.44 USD' + weight: 38 + width: 76 + height: 85 + length: 40 + purchasedItemsCount: 2 + stripeDetails: + subscriptionId: sub_1J6xwG2eZvKYlo2CXu9Zt0Tn + paymentMethod: pm_1OzmzBJYFi4lcbXWHKNdXU7j + paymentIntentId: pi_3OzmzDJYFi4lcbXW1hTBW6ft + customerId: cus_PpRsNHwWdUoRKR + chargeId: ch_3OzmzDJYFi4lcbXW1ndkkrH2 + disputeId: disputeId + refundId: re_3OzmzDJYFi4lcbXW1kFAmlBk + refundReason: fraudulent + stripeCard: + last4: '4242' + brand: Visa + ownerName: Arthur Dent + expires: + year: 2024 + month: 4 + paypalDetails: + orderId: 1a2b3c4d5e6f7g8h9i0j + payerId: 9k8j7i6h5g4f3e2d1c0b + captureId: qwe123rty456uio789p + refundId: abcde12345fghij67890 + refundReason: Customer requested refund + disputeId: zxcvbnm987poiuytrewq + customData: + - key: value + metadata: + isBuyNow: false + isCustomerDeleted: false + isShippingRequired: true + hasDownloads: false + paymentProcessor: stripe + totals: + subtotal: + unit: USD + value: '5892' + string: ' 109.05 USD' + extras: + - type: tax + name: State Taxes + description: NY Taxes (4.00%) + price: + unit: USD + value: '5892' + string: ' 4.36 USD' + - type: tax + name: City Taxes + description: NEW YORK Taxes (4.88%) + price: + unit: USD + value: '5892' + string: ' 5.32 USD' + - type: shipping + name: Flat + description: '' + price: + unit: USD + value: '5892' + string: ' 0.00 USD' + total: + unit: USD + value: '5892' + string: ' 118.73 USD' + downloadFiles: + - id: 5e9a5eba75e0ac242e1b6f64 + name: New product guide + url: >- + https://webflow.com/dashboard/download-digital-product?payload=5d93ba5e38c6b0160ab711d3;e7634a;5eb1aac72912ec06f561278c;5e9a5eba75e0ac242e1b6f63:ka2nehxy:4a1ee0a632feaab94294350087215ed89533f2f530903e3b933b638940e921aa + update-fulfill: + path: /sites/{site_id}/orders/{order_id}/fulfill + method: POST + auth: true + docs: | + Updates an order's status to fulfilled + + Required scope | `ecommerce:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + order_id: + type: string + docs: Unique identifier for an Order + display-name: Fulfill Order + request: + name: OrdersUpdateFulfillRequest + body: + properties: + sendOrderFulfilledEmail: + type: optional + docs: Whether or not the Order Fulfilled email should be sent + default: false + content-type: application/json + response: + docs: Request was successful + type: root.Order + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.ForbiddenError + - root.NotFoundError + - root.ConflictError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + order_id: 5e8518516e147040726cc415 + request: {} + response: + body: + orderId: fc7-128 + status: refunded + comment: >- + Customer requested gift wrapping and a personalized note saying: + Happy Birthday, Ford! 🎉 Please ensure the item is packed with + extra bubble wrap for safe transit. + orderComment: >- + Please gift wrap with a personal note saying "Happy Birthday, + Ford! 🎉 + acceptedOn: '2024-03-29T21:29:21Z' + fulfilledOn: '2024-03-29T21:29:21Z' + refundedOn: '2024-04-08T18:25:04Z' + disputedOn: '2024-03-29T21:29:21Z' + disputeUpdatedOn: '2024-03-29T21:29:21Z' + disputeLastStatus: charge_refunded + customerPaid: + unit: USD + value: '5892' + string: ' 118.73 USD' + netAmount: + unit: USD + value: '5892' + string: ' 112.62 USD' + applicationFee: + unit: USD + value: '5892' + string: ' 2.37 USD' + allAddresses: + - type: billing + japanType: kana + addressee: Arthur Dent + line1: 20 W 34th St + line2: Empire State Building + city: New York + state: New York + country: US + postalCode: '10118' + - type: shipping + japanType: kana + addressee: Arthur Dent + line1: 20 W 34th St + line2: Empire State Building + city: New York + state: New York + country: US + postalCode: '10118' + shippingAddress: + type: shipping + japanType: kanji + addressee: Arthur Dent + line1: 20 W 34th St + line2: Empire State Building + city: New York + state: New York + country: US + postalCode: '10118' + billingAddress: + type: billing + japanType: kana + addressee: Arthur Dent + line1: 20 W 34th St + line2: Empire State Building + city: New York + state: New York + country: US + postalCode: '10118' + shippingProvider: Shipping Company, Co. + shippingTracking: tr00000000001 + shippingTrackingURL: https://www.shippingcompany.com/tracking/tr00000000001 + customerInfo: + fullName: Arthur Dent + email: arthur.dent@example.com + purchasedItems: + - count: 1 + rowTotal: + unit: USD + value: '5892' + string: ' 55.61 USD' + productId: 66072fb61b89448912e26791 + productName: Luxurious Fresh Ball + productSlug: luxurious-fresh-ball + variantId: 66072fb71b89448912e2683f + variantName: 'Luxurious Fresh Ball Generic: Bronze, Practical: Plastic' + variantSlug: luxurious-fresh-ball-generic-bronze-practical-plastic + variantSKU: luxurious-fresh-ball-generic-bronze-practical-plastic + variantImage: + url: >- + https://d1otoma47x30pg.cloudfront.net/66072f39417a2a35b2589cc7/66072fb51b89448912e2672c_image14.jpeg + variantPrice: + unit: USD + value: '5892' + string: ' 55.61 USD' + weight: 11 + width: 82 + height: 70 + length: 9 + - count: 1 + rowTotal: + unit: USD + value: '5892' + string: ' 53.44 USD' + productId: 66072fb61b89448912e26799 + productName: Recycled Steel Gloves + productSlug: recycled-steel-gloves + variantId: 66072fb91b89448912e26ab9 + variantName: 'Recycled Steel Gloves Electronic: Granite, Handcrafted: grey' + variantSlug: recycled-steel-gloves-electronic-granite-handcrafted-grey + variantSKU: recycled-steel-gloves-electronic-granite-handcrafted-grey + variantImage: + url: >- + https://d1otoma47x30pg.cloudfront.net/66072f39417a2a35b2589cc7/66072fb51b89448912e2671e_image2.jpeg + variantPrice: + unit: USD + value: '5892' + string: ' 53.44 USD' + weight: 38 + width: 76 + height: 85 + length: 40 + purchasedItemsCount: 2 + stripeDetails: + subscriptionId: sub_1J6xwG2eZvKYlo2CXu9Zt0Tn + paymentMethod: pm_1OzmzBJYFi4lcbXWHKNdXU7j + paymentIntentId: pi_3OzmzDJYFi4lcbXW1hTBW6ft + customerId: cus_PpRsNHwWdUoRKR + chargeId: ch_3OzmzDJYFi4lcbXW1ndkkrH2 + disputeId: disputeId + refundId: re_3OzmzDJYFi4lcbXW1kFAmlBk + refundReason: fraudulent + stripeCard: + last4: '4242' + brand: Visa + ownerName: Arthur Dent + expires: + year: 2024 + month: 4 + paypalDetails: + orderId: 1a2b3c4d5e6f7g8h9i0j + payerId: 9k8j7i6h5g4f3e2d1c0b + captureId: qwe123rty456uio789p + refundId: abcde12345fghij67890 + refundReason: Customer requested refund + disputeId: zxcvbnm987poiuytrewq + customData: + - key: value + metadata: + isBuyNow: false + isCustomerDeleted: false + isShippingRequired: true + hasDownloads: false + paymentProcessor: stripe + totals: + subtotal: + unit: USD + value: '5892' + string: ' 109.05 USD' + extras: + - type: tax + name: State Taxes + description: NY Taxes (4.00%) + price: + unit: USD + value: '5892' + string: ' 4.36 USD' + - type: tax + name: City Taxes + description: NEW YORK Taxes (4.88%) + price: + unit: USD + value: '5892' + string: ' 5.32 USD' + - type: shipping + name: Flat + description: '' + price: + unit: USD + value: '5892' + string: ' 0.00 USD' + total: + unit: USD + value: '5892' + string: ' 118.73 USD' + downloadFiles: + - id: 5e9a5eba75e0ac242e1b6f64 + name: New product guide + url: >- + https://webflow.com/dashboard/download-digital-product?payload=5d93ba5e38c6b0160ab711d3;e7634a;5eb1aac72912ec06f561278c;5e9a5eba75e0ac242e1b6f63:ka2nehxy:4a1ee0a632feaab94294350087215ed89533f2f530903e3b933b638940e921aa + update-unfulfill: + path: /sites/{site_id}/orders/{order_id}/unfulfill + method: POST + auth: true + docs: | + Updates an order's status to unfulfilled + + Required scope | `ecommerce:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + order_id: + type: string + docs: Unique identifier for an Order + display-name: Unfulfill Order + response: + docs: Request was successful + type: root.Order + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.ForbiddenError + - root.NotFoundError + - root.ConflictError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + order_id: 5e8518516e147040726cc415 + response: + body: + orderId: fc7-128 + status: refunded + comment: >- + Customer requested gift wrapping and a personalized note saying: + Happy Birthday, Ford! 🎉 Please ensure the item is packed with + extra bubble wrap for safe transit. + orderComment: >- + Please gift wrap with a personal note saying "Happy Birthday, + Ford! 🎉 + acceptedOn: '2024-03-29T21:29:21Z' + fulfilledOn: '2024-03-29T21:29:21Z' + refundedOn: '2024-04-08T18:25:04Z' + disputedOn: '2024-03-29T21:29:21Z' + disputeUpdatedOn: '2024-03-29T21:29:21Z' + disputeLastStatus: charge_refunded + customerPaid: + unit: USD + value: '5892' + string: ' 118.73 USD' + netAmount: + unit: USD + value: '5892' + string: ' 112.62 USD' + applicationFee: + unit: USD + value: '5892' + string: ' 2.37 USD' + allAddresses: + - type: billing + japanType: kana + addressee: Arthur Dent + line1: 20 W 34th St + line2: Empire State Building + city: New York + state: New York + country: US + postalCode: '10118' + - type: shipping + japanType: kana + addressee: Arthur Dent + line1: 20 W 34th St + line2: Empire State Building + city: New York + state: New York + country: US + postalCode: '10118' + shippingAddress: + type: shipping + japanType: kanji + addressee: Arthur Dent + line1: 20 W 34th St + line2: Empire State Building + city: New York + state: New York + country: US + postalCode: '10118' + billingAddress: + type: billing + japanType: kana + addressee: Arthur Dent + line1: 20 W 34th St + line2: Empire State Building + city: New York + state: New York + country: US + postalCode: '10118' + shippingProvider: Shipping Company, Co. + shippingTracking: tr00000000001 + shippingTrackingURL: https://www.shippingcompany.com/tracking/tr00000000001 + customerInfo: + fullName: Arthur Dent + email: arthur.dent@example.com + purchasedItems: + - count: 1 + rowTotal: + unit: USD + value: '5892' + string: ' 55.61 USD' + productId: 66072fb61b89448912e26791 + productName: Luxurious Fresh Ball + productSlug: luxurious-fresh-ball + variantId: 66072fb71b89448912e2683f + variantName: 'Luxurious Fresh Ball Generic: Bronze, Practical: Plastic' + variantSlug: luxurious-fresh-ball-generic-bronze-practical-plastic + variantSKU: luxurious-fresh-ball-generic-bronze-practical-plastic + variantImage: + url: >- + https://d1otoma47x30pg.cloudfront.net/66072f39417a2a35b2589cc7/66072fb51b89448912e2672c_image14.jpeg + variantPrice: + unit: USD + value: '5892' + string: ' 55.61 USD' + weight: 11 + width: 82 + height: 70 + length: 9 + - count: 1 + rowTotal: + unit: USD + value: '5892' + string: ' 53.44 USD' + productId: 66072fb61b89448912e26799 + productName: Recycled Steel Gloves + productSlug: recycled-steel-gloves + variantId: 66072fb91b89448912e26ab9 + variantName: 'Recycled Steel Gloves Electronic: Granite, Handcrafted: grey' + variantSlug: recycled-steel-gloves-electronic-granite-handcrafted-grey + variantSKU: recycled-steel-gloves-electronic-granite-handcrafted-grey + variantImage: + url: >- + https://d1otoma47x30pg.cloudfront.net/66072f39417a2a35b2589cc7/66072fb51b89448912e2671e_image2.jpeg + variantPrice: + unit: USD + value: '5892' + string: ' 53.44 USD' + weight: 38 + width: 76 + height: 85 + length: 40 + purchasedItemsCount: 2 + stripeDetails: + subscriptionId: sub_1J6xwG2eZvKYlo2CXu9Zt0Tn + paymentMethod: pm_1OzmzBJYFi4lcbXWHKNdXU7j + paymentIntentId: pi_3OzmzDJYFi4lcbXW1hTBW6ft + customerId: cus_PpRsNHwWdUoRKR + chargeId: ch_3OzmzDJYFi4lcbXW1ndkkrH2 + disputeId: disputeId + refundId: re_3OzmzDJYFi4lcbXW1kFAmlBk + refundReason: fraudulent + stripeCard: + last4: '4242' + brand: Visa + ownerName: Arthur Dent + expires: + year: 2024 + month: 4 + paypalDetails: + orderId: 1a2b3c4d5e6f7g8h9i0j + payerId: 9k8j7i6h5g4f3e2d1c0b + captureId: qwe123rty456uio789p + refundId: abcde12345fghij67890 + refundReason: Customer requested refund + disputeId: zxcvbnm987poiuytrewq + customData: + - key: value + metadata: + isBuyNow: false + isCustomerDeleted: false + isShippingRequired: true + hasDownloads: false + paymentProcessor: stripe + totals: + subtotal: + unit: USD + value: '5892' + string: ' 109.05 USD' + extras: + - type: tax + name: State Taxes + description: NY Taxes (4.00%) + price: + unit: USD + value: '5892' + string: ' 4.36 USD' + - type: tax + name: City Taxes + description: NEW YORK Taxes (4.88%) + price: + unit: USD + value: '5892' + string: ' 5.32 USD' + - type: shipping + name: Flat + description: '' + price: + unit: USD + value: '5892' + string: ' 0.00 USD' + total: + unit: USD + value: '5892' + string: ' 118.73 USD' + downloadFiles: + - id: 5e9a5eba75e0ac242e1b6f64 + name: New product guide + url: >- + https://webflow.com/dashboard/download-digital-product?payload=5d93ba5e38c6b0160ab711d3;e7634a;5eb1aac72912ec06f561278c;5e9a5eba75e0ac242e1b6f63:ka2nehxy:4a1ee0a632feaab94294350087215ed89533f2f530903e3b933b638940e921aa + refund: + path: /sites/{site_id}/orders/{order_id}/refund + method: POST + auth: true + docs: | + This API will reverse a Stripe charge and refund an order back to a + customer. It will also set the order's status to `refunded`. + + Required scope | `ecommerce:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + order_id: + type: string + docs: Unique identifier for an Order + display-name: Refund Order + request: + name: OrdersRefundRequest + body: + properties: + reason: + type: optional + docs: The reason for the refund + content-type: application/json + response: + docs: Request was successful + type: root.Order + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.ForbiddenError + - root.NotFoundError + - root.ConflictError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + order_id: 5e8518516e147040726cc415 + request: {} + response: + body: + orderId: fc7-128 + status: refunded + comment: >- + Customer requested gift wrapping and a personalized note saying: + Happy Birthday, Ford! 🎉 Please ensure the item is packed with + extra bubble wrap for safe transit. + orderComment: >- + Please gift wrap with a personal note saying "Happy Birthday, + Ford! 🎉 + acceptedOn: '2024-03-29T21:29:21Z' + fulfilledOn: '2024-03-29T21:29:21Z' + refundedOn: '2024-04-08T18:25:04Z' + disputedOn: '2024-03-29T21:29:21Z' + disputeUpdatedOn: '2024-03-29T21:29:21Z' + disputeLastStatus: charge_refunded + customerPaid: + unit: USD + value: '5892' + string: ' 118.73 USD' + netAmount: + unit: USD + value: '5892' + string: ' 112.62 USD' + applicationFee: + unit: USD + value: '5892' + string: ' 2.37 USD' + allAddresses: + - type: billing + japanType: kana + addressee: Arthur Dent + line1: 20 W 34th St + line2: Empire State Building + city: New York + state: New York + country: US + postalCode: '10118' + - type: shipping + japanType: kana + addressee: Arthur Dent + line1: 20 W 34th St + line2: Empire State Building + city: New York + state: New York + country: US + postalCode: '10118' + shippingAddress: + type: shipping + japanType: kanji + addressee: Arthur Dent + line1: 20 W 34th St + line2: Empire State Building + city: New York + state: New York + country: US + postalCode: '10118' + billingAddress: + type: billing + japanType: kana + addressee: Arthur Dent + line1: 20 W 34th St + line2: Empire State Building + city: New York + state: New York + country: US + postalCode: '10118' + shippingProvider: Shipping Company, Co. + shippingTracking: tr00000000001 + shippingTrackingURL: https://www.shippingcompany.com/tracking/tr00000000001 + customerInfo: + fullName: Arthur Dent + email: arthur.dent@example.com + purchasedItems: + - count: 1 + rowTotal: + unit: USD + value: '5892' + string: ' 55.61 USD' + productId: 66072fb61b89448912e26791 + productName: Luxurious Fresh Ball + productSlug: luxurious-fresh-ball + variantId: 66072fb71b89448912e2683f + variantName: 'Luxurious Fresh Ball Generic: Bronze, Practical: Plastic' + variantSlug: luxurious-fresh-ball-generic-bronze-practical-plastic + variantSKU: luxurious-fresh-ball-generic-bronze-practical-plastic + variantImage: + url: >- + https://d1otoma47x30pg.cloudfront.net/66072f39417a2a35b2589cc7/66072fb51b89448912e2672c_image14.jpeg + variantPrice: + unit: USD + value: '5892' + string: ' 55.61 USD' + weight: 11 + width: 82 + height: 70 + length: 9 + - count: 1 + rowTotal: + unit: USD + value: '5892' + string: ' 53.44 USD' + productId: 66072fb61b89448912e26799 + productName: Recycled Steel Gloves + productSlug: recycled-steel-gloves + variantId: 66072fb91b89448912e26ab9 + variantName: 'Recycled Steel Gloves Electronic: Granite, Handcrafted: grey' + variantSlug: recycled-steel-gloves-electronic-granite-handcrafted-grey + variantSKU: recycled-steel-gloves-electronic-granite-handcrafted-grey + variantImage: + url: >- + https://d1otoma47x30pg.cloudfront.net/66072f39417a2a35b2589cc7/66072fb51b89448912e2671e_image2.jpeg + variantPrice: + unit: USD + value: '5892' + string: ' 53.44 USD' + weight: 38 + width: 76 + height: 85 + length: 40 + purchasedItemsCount: 2 + stripeDetails: + subscriptionId: sub_1J6xwG2eZvKYlo2CXu9Zt0Tn + paymentMethod: pm_1OzmzBJYFi4lcbXWHKNdXU7j + paymentIntentId: pi_3OzmzDJYFi4lcbXW1hTBW6ft + customerId: cus_PpRsNHwWdUoRKR + chargeId: ch_3OzmzDJYFi4lcbXW1ndkkrH2 + disputeId: disputeId + refundId: re_3OzmzDJYFi4lcbXW1kFAmlBk + refundReason: fraudulent + stripeCard: + last4: '4242' + brand: Visa + ownerName: Arthur Dent + expires: + year: 2024 + month: 4 + paypalDetails: + orderId: 1a2b3c4d5e6f7g8h9i0j + payerId: 9k8j7i6h5g4f3e2d1c0b + captureId: qwe123rty456uio789p + refundId: abcde12345fghij67890 + refundReason: Customer requested refund + disputeId: zxcvbnm987poiuytrewq + customData: + - key: value + metadata: + isBuyNow: false + isCustomerDeleted: false + isShippingRequired: true + hasDownloads: false + paymentProcessor: stripe + totals: + subtotal: + unit: USD + value: '5892' + string: ' 109.05 USD' + extras: + - type: tax + name: State Taxes + description: NY Taxes (4.00%) + price: + unit: USD + value: '5892' + string: ' 4.36 USD' + - type: tax + name: City Taxes + description: NEW YORK Taxes (4.88%) + price: + unit: USD + value: '5892' + string: ' 5.32 USD' + - type: shipping + name: Flat + description: '' + price: + unit: USD + value: '5892' + string: ' 0.00 USD' + total: + unit: USD + value: '5892' + string: ' 118.73 USD' + downloadFiles: + - id: 5e9a5eba75e0ac242e1b6f64 + name: New product guide + url: >- + https://webflow.com/dashboard/download-digital-product?payload=5d93ba5e38c6b0160ab711d3;e7634a;5eb1aac72912ec06f561278c;5e9a5eba75e0ac242e1b6f63:ka2nehxy:4a1ee0a632feaab94294350087215ed89533f2f530903e3b933b638940e921aa + source: + openapi: ../../../referenced-specs/v2.yml + display-name: Orders diff --git a/.mock/definition/pages.yml b/.mock/definition/pages.yml new file mode 100644 index 0000000..b3fdcd1 --- /dev/null +++ b/.mock/definition/pages.yml @@ -0,0 +1,443 @@ +imports: + root: __package__.yml +service: + auth: false + base-path: '' + endpoints: + list: + path: /sites/{site_id}/pages + method: GET + auth: true + docs: | + List of all pages for a site. + + Required scope | `pages:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + display-name: List Pages + request: + name: PagesListRequest + query-parameters: + localeId: + type: optional + docs: >- + Unique identifier for a specific locale. Applicable, when using + localization. + limit: + type: optional + docs: 'Maximum number of records to be returned (max limit: 100)' + offset: + type: optional + docs: >- + Offset used for pagination if the results have more than limit + records + response: + docs: Request was successful + type: root.PageList + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + query-parameters: + localeId: 65427cf400e02b306eaa04a0 + response: + body: + pages: + - id: 6596da6045e56dee495bcbba + siteId: 6258612d1ee792848f805dcf + title: Guide to the Galaxy + slug: guide-to-the-galaxy + parentId: 6419db964a9c435aa3af6251 + collectionId: 6390c49774a71f12831a08e3 + createdOn: '2024-03-11T10:42:00Z' + lastUpdated: '2024-03-11T10:42:42Z' + archived: false + draft: false + canBranch: true + isBranch: false + isMembersOnly: false + seo: + title: The Ultimate Hitchhiker's Guide to the Galaxy + description: >- + Everything you need to know about the galaxy, from + avoiding Vogon poetry to the importance of towels. + openGraph: + title: Explore the Cosmos with The Ultimate Guide + titleCopied: false + description: >- + Dive deep into the mysteries of the universe with your + guide to everything galactic. + descriptionCopied: false + localeId: 653fd9af6a07fc9cfd7a5e57 + publishedPath: /en-us/guide-to-the-galaxy + - id: 6596da6045e56dee495bcbad + siteId: 6258612d1ee792848f805dcf + title: Towel Day Celebrations + slug: towel-day + parentId: 6419db964a9c435aa3af6251 + collectionId: 6390c49774a71f12831a08e3 + createdOn: '2024-05-25T09:00:00Z' + lastUpdated: '2024-05-25T09:42:00Z' + archived: false + draft: false + canBranch: true + isBranch: false + isMembersOnly: false + seo: + title: Celebrate Towel Day - The Hitchhiker's Guide to the Galaxy + description: >- + A guide to celebrating Towel Day, in honor of the most + massively useful thing an interstellar hitchhiker can + have. + openGraph: + title: Towel Day - Don't Panic + titleCopied: false + description: >- + Join the galaxy in celebrating Towel Day, the day + dedicated to carrying towels everywhere in memory of + Douglas Adams. + descriptionCopied: false + localeId: 653fd9af6a07fc9cfd7a5e57 + publishedPath: /en-us/towel-day + pagination: + limit: 20 + offset: 0 + total: 2 + get-metadata: + path: /pages/{page_id} + method: GET + auth: true + docs: | + Get metadata information for a single page. + + Required scope | `pages:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + page_id: + type: string + docs: Unique identifier for a Page + display-name: Get Page Metadata + request: + name: PagesGetMetadataRequest + query-parameters: + localeId: + type: optional + docs: >- + Unique identifier for a specific locale. Applicable, when using + localization. + response: + docs: Request was successful + type: root.Page + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + page_id: 63c720f9347c2139b248e552 + query-parameters: + localeId: 65427cf400e02b306eaa04a0 + response: + body: + id: 6596da6045e56dee495bcbba + siteId: 6258612d1ee792848f805dcf + title: Guide to the Galaxy + slug: guide-to-the-galaxy + parentId: 6419db964a9c435aa3af6251 + collectionId: 6390c49774a71f12831a08e3 + createdOn: '2024-03-11T10:42:00Z' + lastUpdated: '2024-03-11T10:42:42Z' + archived: false + draft: false + canBranch: true + isBranch: false + isMembersOnly: false + seo: + title: The Ultimate Hitchhiker's Guide to the Galaxy + description: >- + Everything you need to know about the galaxy, from avoiding + Vogon poetry to the importance of towels. + openGraph: + title: Explore the Cosmos with The Ultimate Guide + titleCopied: false + description: >- + Dive deep into the mysteries of the universe with your guide + to everything galactic. + descriptionCopied: false + localeId: 653fd9af6a07fc9cfd7a5e57 + publishedPath: /en-us/guide-to-the-galaxy + update-page-settings: + path: /pages/{page_id} + method: PUT + auth: true + docs: | + Update Page-level metadata, including SEO and Open Graph fields. + + Required scope | `pages:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + page_id: + type: string + docs: Unique identifier for a Page + display-name: Update Page Metadata + request: + body: root.Page + query-parameters: + localeId: + type: optional + docs: >- + Unique identifier for a specific locale. Applicable, when using + localization. + name: UpdatePageSettingsRequest + content-type: application/json + response: + docs: Request was successful + type: root.Page + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + page_id: 63c720f9347c2139b248e552 + query-parameters: + localeId: 65427cf400e02b306eaa04a0 + request: + id: 6596da6045e56dee495bcbba + siteId: 6258612d1ee792848f805dcf + title: Guide to the Galaxy + slug: guide-to-the-galaxy + createdOn: '2024-03-11T10:42:00Z' + lastUpdated: '2024-03-11T10:42:42Z' + archived: false + draft: false + canBranch: true + isBranch: false + seo: + title: The Ultimate Hitchhiker's Guide to the Galaxy + description: >- + Everything you need to know about the galaxy, from avoiding + Vogon poetry to the importance of towels. + openGraph: + title: Explore the Cosmos with The Ultimate Guide + titleCopied: false + description: >- + Dive deep into the mysteries of the universe with your guide to + everything galactic. + descriptionCopied: false + localeId: 653fd9af6a07fc9cfd7a5e57 + publishedPath: /en-us/guide-to-the-galaxy + response: + body: + id: 6596da6045e56dee495bcbba + siteId: 6258612d1ee792848f805dcf + title: Guide to the Galaxy + slug: guide-to-the-galaxy + parentId: 6419db964a9c435aa3af6251 + collectionId: 6390c49774a71f12831a08e3 + createdOn: '2024-03-11T10:42:00Z' + lastUpdated: '2024-03-11T10:42:42Z' + archived: false + draft: false + canBranch: true + isBranch: false + isMembersOnly: false + seo: + title: The Ultimate Hitchhiker's Guide to the Galaxy + description: >- + Everything you need to know about the galaxy, from avoiding + Vogon poetry to the importance of towels. + openGraph: + title: Explore the Cosmos with The Ultimate Guide + titleCopied: false + description: >- + Dive deep into the mysteries of the universe with your guide + to everything galactic. + descriptionCopied: false + localeId: 653fd9af6a07fc9cfd7a5e57 + publishedPath: /en-us/guide-to-the-galaxy + get-content: + path: /pages/{page_id}/dom + method: GET + auth: true + docs: > + Get static content from a static page. + + + If you do not provide a Locale ID in your request, the response will + return any content that can be localized from the Primary locale. + + + Required scope | `pages:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + page_id: + type: string + docs: Unique identifier for a Page + display-name: Get Page Content + request: + name: PagesGetContentRequest + query-parameters: + localeId: + type: optional + docs: >- + Unique identifier for a specific locale. Applicable, when using + localization. + limit: + type: optional + docs: 'Maximum number of records to be returned (max limit: 100)' + offset: + type: optional + docs: >- + Offset used for pagination if the results have more than limit + records + response: + docs: Request was successful + type: root.Dom + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.ForbiddenError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + page_id: 63c720f9347c2139b248e552 + query-parameters: + localeId: 65427cf400e02b306eaa04a0 + response: + body: + pageId: 658205daa3e8206a523b5ad4 + nodes: + - id: a245c12d-995b-55ee-5ec7-aa36a6cad623 + type: text + text: + html:

The Hitchhiker's Guide to the Galaxy

+ text: The Hitchhiker's Guide to the Galaxy + attributes: + key: value + - id: a245c12d-995b-55ee-5ec7-aa36a6cad627 + type: text + text: + html: >- +

Don't Panic!

Always know where your towel + is.

+ attributes: + key: value + - id: a245c12d-995b-55ee-5ec7-aa36a6cad629 + type: image + image: + alt: Marvin, the Paranoid Android + assetId: 659595234426a9fcbad57043 + attributes: + key: value + pagination: + limit: 3 + offset: 0 + total: 3 + update-static-content: + path: /pages/{page_id}/dom + method: POST + auth: true + docs: > + This endpoint allows for updating static content on a static page within + a secondary locale. It is designed specifically for localized pages and + can handle up to 1000 nodes per request. + +

Note:This + endpoint is specifically for localized pages. Ensure that the locale + specified is a valid secondary locale for the site.

+ + + Required scope | `pages:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + page_id: + type: string + docs: Unique identifier for a Page + display-name: Update Page Content + request: + name: DomWrite + query-parameters: + localeId: + type: optional + docs: >- + Unique identifier for a specific locale. Applicable, when using + localization. + body: + properties: + nodes: list + content-type: application/json + response: + docs: Request was successful + type: UpdateStaticContentResponse + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.ForbiddenError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + page_id: 63c720f9347c2139b248e552 + query-parameters: + localeId: 65427cf400e02b306eaa04a0 + request: + nodes: + - nodeId: a245c12d-995b-55ee-5ec7-aa36a6cad623 + text:

The Hitchhiker’s Guide to the Galaxy

+ - nodeId: a245c12d-995b-55ee-5ec7-aa36a6cad627 + text: >- +

Don’t Panic!

Always know where your towel + is.

+ - nodeId: a245c12d-995b-55ee-5ec7-aa36a6cad629 + text: >- + Marvin, the Paranoid Android + response: + body: + errors: + - errors + source: + openapi: ../../../referenced-specs/v2.yml + display-name: Pages +types: + DomWriteNodesItem: + properties: + nodeId: + type: string + docs: Node UUID + text: + type: string + docs: >- + HTML content of the node, including the HTML tag. The HTML tags must + be the same as what's returned from the Get Content endpoint. + source: + openapi: ../../../referenced-specs/v2.yml + inline: true + UpdateStaticContentResponse: + properties: + errors: + docs: A list of error messages, if any. + type: list + source: + openapi: ../../../referenced-specs/v2.yml diff --git a/.mock/definition/pages/scripts.yml b/.mock/definition/pages/scripts.yml new file mode 100644 index 0000000..fc0bbe5 --- /dev/null +++ b/.mock/definition/pages/scripts.yml @@ -0,0 +1,169 @@ +imports: + root: ../__package__.yml +service: + auth: false + base-path: '' + endpoints: + get-custom-code: + path: /pages/{page_id}/custom_code + method: GET + auth: true + docs: > + Get all registered scripts that have been applied to a specific Page. + + + In order to use the Custom Code APIs for Sites and Pages, Custom Code + Scripts must first be registered + + to a Site via the `registered_scripts` endpoints, and then applied to a + Site or Page using the appropriate + + `custom_code` endpoints. + +
Access to this + endpoint requires a bearer token from a Data + Client App.
+ + + Required scope | `custom_code:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + page_id: + type: string + docs: Unique identifier for a Page + display-name: Get Custom Code + response: + docs: Request was successful + type: root.ScriptApplyList + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + page_id: 63c720f9347c2139b248e552 + response: + body: + scripts: + - id: id + location: header + version: version + attributes: + key: value + lastUpdated: lastUpdated + createdOn: createdOn + upsert-custom-code: + path: /pages/{page_id}/custom_code + method: PUT + auth: true + docs: > + Add a registered script to a Page. + + + In order to use the Custom Code APIs for Sites and Pages, Custom Code + Scripts must first be registered + + to a Site via the `registered_scripts` endpoints, and then applied to a + Site or Page using the appropriate + + `custom_code` endpoints. + +
Access to this + endpoint requires a bearer token from a Data + Client App.
+ + + Required scope | `custom_code:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + page_id: + type: string + docs: Unique identifier for a Page + display-name: Add/Update Custom Code + request: + body: root.ScriptApplyList + content-type: application/json + response: + docs: Request was successful + type: root.ScriptApplyList + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + page_id: 63c720f9347c2139b248e552 + request: + scripts: + - id: cms_slider + location: header + version: 1.0.0 + attributes: + my-attribute: some-value + - id: alert + location: header + version: 0.0.1 + response: + body: + scripts: + - id: cms_slider + location: header + version: 1.0.0 + attributes: + my-attribute: some-value + - id: alert + location: header + version: 0.0.1 + attributes: + key: value + lastUpdated: '2022-10-26T00:28:54.191Z' + createdOn: '2022-10-26T00:28:54.191Z' + delete-custom-code: + path: /pages/{page_id}/custom_code + method: DELETE + auth: true + docs: > + Delete the custom code block that an app has created for a page + + + In order to use the Custom Code APIs for Sites and Pages, Custom Code + Scripts must first be registered + + to a Site via the `registered_scripts` endpoints, and then applied to a + Site or Page using the appropriate + + `custom_code` endpoints. + +
Access to this + endpoint requires a bearer token from a Data + Client App.
+ + + Required scope | `custom_code:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + page_id: + type: string + docs: Unique identifier for a Page + display-name: Delete Custom Code + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + page_id: 63c720f9347c2139b248e552 + source: + openapi: ../../../referenced-specs/v2.yml diff --git a/.mock/definition/products.yml b/.mock/definition/products.yml new file mode 100644 index 0000000..076b222 --- /dev/null +++ b/.mock/definition/products.yml @@ -0,0 +1,500 @@ +imports: + root: __package__.yml +service: + auth: false + base-path: '' + endpoints: + list: + path: /sites/{site_id}/products + method: GET + auth: true + docs: > + Retrieve all products for a site. + + + Use `limit` and `offset` to page through all products with subsequent + requests. All SKUs for each product + + will also be fetched and returned. The `limit`, `offset` and `total` + values represent Products only and do not include any SKUs. + + + Required scope | `ecommerce:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + display-name: List Products & SKUs + request: + name: ProductsListRequest + query-parameters: + offset: + type: optional + docs: >- + Offset used for pagination if the results have more than limit + records + limit: + type: optional + docs: 'Maximum number of records to be returned (max limit: 100)' + response: + docs: Request was successful + type: root.ProductAndSkUsList + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.ForbiddenError + - root.NotFoundError + - root.ConflictError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + response: + body: + items: + - product: + id: 660eb7a486d1d6e0412292d7 + cmsLocaleId: 653ad57de882f528b32e810e + lastPublished: '2024-04-04T14:24:19Z' + lastUpdated: '2024-04-04T14:30:19Z' + createdOn: '2024-04-04T14:22:28Z' + isArchived: false + isDraft: false + fieldData: + name: T-Shirt + slug: t-shirt + description: A plain cotton t-shirt. + shippable: true + sku-properties: + - id: Color + name: Color + enum: + - id: id + name: Royal Blue + slug: royal-blue + skus: + - id: 580e63fc8c9a982ac9b8b745 + cmsLocaleId: 653ad57de882f528b32e810e + lastPublished: '2023-03-17T18:47:35Z' + lastUpdated: '2023-03-17T18:47:35Z' + createdOn: '2023-03-17T18:47:35Z' + fieldData: + sku-values: + ff42fee0113744f693a764e3431a9cc2: 64a74715c456e36762fc39a1 + name: Blue T-shirt + slug: t-shirt-blue + price: + value: 100 + unit: USD + quantity: 10 + pagination: + limit: 100 + offset: 0 + total: 100 + create: + path: /sites/{site_id}/products + method: POST + auth: true + docs: > + Create a new product and SKU. + + + When you create a product, you will always create a SKU, since a Product + Item must have, at minimum, a single SKU. + + + To create a Product with multiple SKUs - for example a T-shirt in sizes + small, medium and large: + - Create parameters in `sku-properties`, also known as [product options and variants.](https://help.webflow.com/hc/en-us/articles/33961334531347-Create-product-options-and-variants). + - A single `sku-property` would be `color`. Within the `color` property, list the various colors of T-shirts as an array of `enum` values: `royal-blue`, `crimson-red`, and `forrest-green`. + - Once, you've created a Product and its `sku-properties` with `enum` values, Webflow will create a **default SKU**, which will automatically be a combination of the first `sku-properties` you've created. + - In our example, the default SKU will be a Royal Blue T-Shirt, because our first `enum` of our Color `sku-property` is Royal Blue. + - After you've created your product, you can create additional SKUs using the [Create SKU endpoint.](/data/reference/ecommerce/products-sk-us/create-sku) + + Upon creation, the default product type will be `Advanced`, which + ensures all Product and SKU fields will be shown to users in the + Designer. + + + Required scope | `ecommerce:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + display-name: Create Product & SKU + request: + name: ProductSkuCreate + body: + properties: + publishStatus: optional + product: optional + sku: optional + content-type: application/json + response: + docs: Request was successful + type: root.ProductAndSkUs + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.ForbiddenError + - root.NotFoundError + - root.ConflictError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + request: {} + response: + body: + product: + id: 660eb7a486d1d6e0412292d7 + cmsLocaleId: 653ad57de882f528b32e810e + lastPublished: '2024-04-04T14:24:19Z' + lastUpdated: '2024-04-04T14:30:19Z' + createdOn: '2024-04-04T14:22:28Z' + isArchived: false + isDraft: false + fieldData: + name: T-Shirt + slug: t-shirt + description: A plain cotton t-shirt. + shippable: true + sku-properties: + - id: Color + name: Color + enum: + - id: id + name: Royal Blue + slug: royal-blue + categories: + - categories + tax-category: standard-taxable + default-sku: default-sku + ec-product-type: ff42fee0113744f693a764e3431a9cc2 + skus: + - id: 580e63fc8c9a982ac9b8b745 + cmsLocaleId: 653ad57de882f528b32e810e + lastPublished: '2023-03-17T18:47:35Z' + lastUpdated: '2023-03-17T18:47:35Z' + createdOn: '2023-03-17T18:47:35Z' + fieldData: + sku-values: + ff42fee0113744f693a764e3431a9cc2: 64a74715c456e36762fc39a1 + name: Blue T-shirt + slug: t-shirt-blue + price: + value: 100 + unit: USD + quantity: 10 + get: + path: /sites/{site_id}/products/{product_id} + method: GET + auth: true + docs: | + Retrieve a single product by its ID. All of its SKUs will also be + retrieved. + + Required scope | `ecommerce:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + product_id: + type: string + docs: Unique identifier for a Product + display-name: Get Product and SKUs + response: + docs: Request was successful + type: root.ProductAndSkUs + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.ForbiddenError + - root.NotFoundError + - root.ConflictError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + product_id: 580e63fc8c9a982ac9b8b745 + response: + body: + product: + id: 660eb7a486d1d6e0412292d7 + cmsLocaleId: 653ad57de882f528b32e810e + lastPublished: '2024-04-04T14:24:19Z' + lastUpdated: '2024-04-04T14:30:19Z' + createdOn: '2024-04-04T14:22:28Z' + isArchived: false + isDraft: false + fieldData: + name: T-Shirt + slug: t-shirt + description: A plain cotton t-shirt. + shippable: true + sku-properties: + - id: Color + name: Color + enum: + - id: id + name: Royal Blue + slug: royal-blue + categories: + - categories + tax-category: standard-taxable + default-sku: default-sku + ec-product-type: ff42fee0113744f693a764e3431a9cc2 + skus: + - id: 580e63fc8c9a982ac9b8b745 + cmsLocaleId: 653ad57de882f528b32e810e + lastPublished: '2023-03-17T18:47:35Z' + lastUpdated: '2023-03-17T18:47:35Z' + createdOn: '2023-03-17T18:47:35Z' + fieldData: + sku-values: + ff42fee0113744f693a764e3431a9cc2: 64a74715c456e36762fc39a1 + name: Blue T-shirt + slug: t-shirt-blue + price: + value: 100 + unit: USD + quantity: 10 + update: + path: /sites/{site_id}/products/{product_id} + method: PATCH + auth: true + docs: > + Update an existing Product. + + + Updating an existing Product will set the product type to `Advanced`, + which ensures all Product and SKU fields will be shown to users in the + Designer. + + + Required scope | `ecommerce:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + product_id: + type: string + docs: Unique identifier for a Product + display-name: Update Product + request: + name: ProductSkuUpdate + body: + properties: + publishStatus: optional + product: optional + sku: optional + content-type: application/json + response: + docs: Request was successful + type: root.Product + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.ForbiddenError + - root.NotFoundError + - root.ConflictError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + product_id: 580e63fc8c9a982ac9b8b745 + request: {} + response: + body: + id: 660eb7a486d1d6e0412292d7 + cmsLocaleId: 653ad57de882f528b32e810e + lastPublished: '2024-04-04T14:24:19Z' + lastUpdated: '2024-04-04T14:30:19Z' + createdOn: '2024-04-04T14:22:28Z' + isArchived: false + isDraft: false + fieldData: + name: T-Shirt + slug: t-shirt + description: A plain cotton t-shirt. + shippable: true + sku-properties: + - id: Color + name: Color + enum: + - id: id + name: Royal Blue + slug: royal-blue + categories: + - categories + tax-category: standard-taxable + default-sku: default-sku + ec-product-type: ff42fee0113744f693a764e3431a9cc2 + create-sku: + path: /sites/{site_id}/products/{product_id}/skus + method: POST + auth: true + docs: > + Create additional SKUs to manage every [option and variant of your + Product.](https://help.webflow.com/hc/en-us/articles/33961334531347-Create-product-options-and-variants) + + + Creating SKUs through the API will set the product type to `Advanced`, + which ensures all Product and SKU fields will be shown to users in the + Designer. + + + Required scope | `ecommerce:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + product_id: + type: string + docs: Unique identifier for a Product + display-name: Create SKU + request: + name: ProductsCreateSkuRequest + body: + properties: + publishStatus: optional + skus: + docs: An array of the SKU data your are adding + type: list + content-type: application/json + response: + docs: Request was successful + type: ProductsCreateSkuResponse + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.ForbiddenError + - root.NotFoundError + - root.ConflictError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + product_id: 580e63fc8c9a982ac9b8b745 + request: + skus: + - {} + response: + body: + skus: + - id: 580e63fc8c9a982ac9b8b745 + cmsLocaleId: 653ad57de882f528b32e810e + lastPublished: '2023-03-17T18:47:35Z' + lastUpdated: '2023-03-17T18:47:35Z' + createdOn: '2023-03-17T18:47:35Z' + fieldData: + sku-values: + ff42fee0113744f693a764e3431a9cc2: 64a74715c456e36762fc39a1 + name: Blue T-shirt + slug: t-shirt-blue + price: + value: 100 + unit: USD + quantity: 10 + update-sku: + path: /sites/{site_id}/products/{product_id}/skus/{sku_id} + method: PATCH + auth: true + docs: > + Update a specified SKU. + + + Updating an existing SKU will set the Product type to `Advanced`, which + ensures all Product and SKU fields will be shown to users in the + Designer. + + + Required scope | `ecommerce:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + product_id: + type: string + docs: Unique identifier for a Product + sku_id: + type: string + docs: Unique identifier for a SKU + display-name: Update SKU + request: + name: ProductsUpdateSkuRequest + body: + properties: + publishStatus: optional + sku: root.Sku + content-type: application/json + response: + docs: Request was successful + type: root.Sku + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.ForbiddenError + - root.NotFoundError + - root.ConflictError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + product_id: 580e63fc8c9a982ac9b8b745 + sku_id: 5e8518516e147040726cc415 + request: + sku: {} + response: + body: + id: 580e63fc8c9a982ac9b8b745 + cmsLocaleId: 653ad57de882f528b32e810e + lastPublished: '2023-03-17T18:47:35Z' + lastUpdated: '2023-03-17T18:47:35Z' + createdOn: '2023-03-17T18:47:35Z' + fieldData: + sku-values: + ff42fee0113744f693a764e3431a9cc2: 64a74715c456e36762fc39a1 + name: Blue T-shirt + slug: t-shirt-blue + price: + value: 100 + unit: USD + compare-at-price: + value: 100 + unit: USD + ec-sku-billing-method: one-time + ec-sku-subscription-plan: + interval: day + frequency: 1 + trial: 7 + plans: + - {} + track-inventory: true + quantity: 10 + source: + openapi: ../../../referenced-specs/v2.yml +types: + ProductsCreateSkuResponse: + properties: + skus: optional> + source: + openapi: ../../../referenced-specs/v2.yml diff --git a/.mock/definition/scripts.yml b/.mock/definition/scripts.yml new file mode 100644 index 0000000..7fde114 --- /dev/null +++ b/.mock/definition/scripts.yml @@ -0,0 +1,257 @@ +imports: + root: __package__.yml +service: + auth: false + base-path: '' + endpoints: + list: + path: /sites/{site_id}/registered_scripts + method: GET + auth: true + docs: > + List of scripts registered to a Site. + + + In order to use the Custom Code APIs for Sites and Pages, Custom Code + Scripts must first be registered + + to a Site via the `registered_scripts` endpoints, and then applied to a + Site or Page using the appropriate + + `custom_code` endpoints. + + Additionally, Scripts can be remotely hosted, or registered as inline + snippets. + +
Access to this + endpoint requires a bearer token from a Data + Client App.
+ + + Required scope | `custom_code:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + display-name: Get Registered Scripts + response: + docs: Request was successful + type: root.RegisteredScriptList + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + response: + body: + registeredScripts: + - id: alert + canCopy: false + displayName: Alert + hostedLocation: https://cdn.webflow.io/.../alert-0.0.1.js + integrityHash: integrityHash + createdOn: '2022-10-26T00:28:54.191Z' + lastUpdated: lastUpdated + version: 0.0.1 + - id: alert + canCopy: false + displayName: Alert + hostedLocation: https://cdn.webflow.io/.../alert-0.0.2.js + integrityHash: integrityHash + createdOn: '2022-10-26T00:28:54.191Z' + lastUpdated: lastUpdated + version: 0.0.2 + - id: cms_slider + canCopy: true + displayName: CMS Slider + hostedLocation: https://cdn.jsdelivr.net/.../cms_slider.js + integrityHash: >- + sha384-J+YlJ8v0gpaRoKH7SbFbEmxOZlAxLiwNjfSsBhDooGa5roXlPPpXbEevck4J7YZ+ + createdOn: '2022-10-26T00:28:54.191Z' + lastUpdated: lastUpdated + version: 1.0.0 + register-hosted: + path: /sites/{site_id}/registered_scripts/hosted + method: POST + auth: true + docs: > + Add a script to a Site's Custom Code registry. + + + In order to use the Custom Code APIs for Sites and Pages, Custom Code + Scripts must first be registered + + to a Site via the `registered_scripts` endpoints, and then applied to a + Site or Page using the appropriate + + `custom_code` endpoints. + + Additionally, Scripts can be remotely hosted, or registered as inline + snippets. + +
Access to this + endpoint requires a bearer token from a Data + Client App.
+ + + Required scope | `custom_code:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + display-name: Register Script - Hosted + request: + name: CustomCodeHostedRequest + body: + properties: + hostedLocation: + type: string + docs: URI for an externally hosted script location + integrityHash: + type: string + docs: Sub-Resource Integrity Hash + canCopy: + type: optional + docs: >- + Define whether the script can be copied on site duplication and + transfer + default: false + version: + type: string + docs: >- + A Semantic Version (SemVer) string, denoting the version of the + script + displayName: + type: string + docs: >- + User-facing name for the script. Must be between 1 and 50 + alphanumeric characters + content-type: application/json + response: + docs: Request was successful + type: root.CustomCodeHostedResponse + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + request: + hostedLocation: hostedLocation + integrityHash: integrityHash + version: version + displayName: displayName + response: + body: + id: cms_slider + canCopy: true + displayName: CMS Slider + hostedLocation: https://cdn.jsdelivr.net/.../cmsslider.js + integrityHash: >- + sha384-J+YlJ8v0gpaRoKH7SbFbEmxOZlAxLiwNjfSsBhDooGa5roXlPPpXbEevck4J7YZ+ + createdOn: '2022-10-26T00:28:54.191Z' + lastUpdated: lastUpdated + version: 1.0.0 + register-inline: + path: /sites/{site_id}/registered_scripts/inline + method: POST + auth: true + docs: > + Add a script to a Site's Custom Code registry. Inline scripts can be + between 1 and 2000 characters. + + + In order to use the Custom Code APIs for Sites and Pages, Custom Code + Scripts must first be registered + + to a Site via the `registered_scripts` endpoints, and then applied to a + Site or Page using the appropriate + + `custom_code` endpoints. + + +
Access to this + endpoint requires a bearer token from a Data + Client App.
+ + + Required scope | `custom_code:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + display-name: Register Script - Inline + request: + name: CustomCodeInlineRequest + body: + properties: + sourceCode: + type: string + docs: The code to be added to the site (to be hosted by Webflow). + integrityHash: + type: optional + docs: >- + Sub-Resource Integrity Hash. Only required for externally hosted + scripts (passed via hostedLocation) + canCopy: + type: optional + docs: >- + Define whether the script can be copied on site duplication and + transfer + default: false + version: + type: string + docs: >- + A Semantic Version (SemVer) string, denoting the version of the + script + displayName: + type: string + docs: >- + User-facing name for the script. Must be between 1 and 50 + alphanumeric characters + content-type: application/json + response: + docs: Created + type: root.CustomCodeInlineResponse + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + request: + sourceCode: alert('hello world'); + version: 0.0.1 + displayName: Alert + response: + body: + id: alert + canCopy: false + displayName: Alert + hostedLocation: >- + https://uploads-ssl.webflow.com/6258612d1ee792848f805dcf%2F64b6c769ff52ba6c3d904a91%2F660d6e15b3d1696f2d2b1447%2Falert-0.0.1.js + integrityHash: integrityHash + createdOn: '2022-10-26T00:28:54.191Z' + lastUpdated: lastUpdated + version: 0.0.1 + source: + openapi: ../../../referenced-specs/v2.yml diff --git a/.mock/definition/sites.yml b/.mock/definition/sites.yml new file mode 100644 index 0000000..31a7f31 --- /dev/null +++ b/.mock/definition/sites.yml @@ -0,0 +1,299 @@ +imports: + root: __package__.yml +service: + auth: false + base-path: '' + endpoints: + list: + path: /sites + method: GET + auth: true + docs: | + List of all sites the provided access token is able to access. + + Required scope | `sites:read` + source: + openapi: ../../../referenced-specs/v2.yml + display-name: List Sites + response: + docs: Request was successful + type: root.Sites + errors: + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + examples: + - response: + body: + sites: + - id: 42e63e98c9a982ac9b8b741 + workspaceId: 42e63fc8c9a982ac9b8b744 + createdOn: '1979-10-12T12:00:00Z' + displayName: Heart of Gold Spaceship + shortName: heart-of-gold + lastPublished: '2023-04-02T12:42:00Z' + lastUpdated: '2016-10-24T19:43:17Z' + previewUrl: >- + https://d1otoma47x30pg.cloudfront.net/42e63e98c9a982ac9b8b741/197910121200.png + timeZone: DeepSpace/InfiniteImprobability + parentFolderId: 1as2d3f4g5h6j7k8l9z0x1c2v3b4n5m6 + customDomains: + - id: 589a331aa51e760df7ccb89e + url: heartofgold.galaxy + locales: + primary: + id: 653fd9af6a07fc9cfd7a5e57 + cmsLocaleId: 653ad57de882f528b32e810e + enabled: true + displayName: English - Heart of Gold Standard + redirect: false + subdirectory: /en + tag: The Ultimate Answer + secondary: + - id: 653fd9af6a07fc9cfd7a5e58 + cmsLocaleId: 653ad57de882f528b32e810g + enabled: true + displayName: Betelgeusian - Vogon Liaison + redirect: true + subdirectory: /bet + tag: Vogon + - id: 653fd9af6a07fc9cfd7a5e59 + cmsLocaleId: 653ad57de882f528b32e810h + enabled: false + displayName: Magrathean - Custom Planet Designs + redirect: true + subdirectory: /mg + tag: Magrathean + dataCollectionEnabled: true + dataCollectionType: always + - id: 42e63e98c9a982ac9b8b742 + workspaceId: 42e63fc8c9a982ac9b8b745 + createdOn: '1981-10-12T12:00:00Z' + displayName: Marvin's Personal Blog + shortName: paranoid-android + lastPublished: '2023-04-02T12:45:00Z' + lastUpdated: '2016-10-24T19:43:17Z' + previewUrl: >- + https://d1otoma47x30pg.cloudfront.net/42e63e98c9a982ac9b8b742/198110121200.png + timeZone: DeepSpace/Depression + parentFolderId: 1as2d3f4g5h6j7k8l9z0x1c2v3b4n5m6 + customDomains: + - id: 589a331aa51e760df7ccb89f + url: marvin.blog + locales: + primary: + id: 653fd9af6a07fc9cfd7a5e57 + cmsLocaleId: 653ad57de882f528b32e810e + enabled: true + displayName: English - Marvin's Musings + redirect: false + subdirectory: /en + tag: English + secondary: + - id: 653fd9af6a07fc9cfd7a5e56 + cmsLocaleId: 653ad57de882f528b32e810f + enabled: true + displayName: Squornshellous - Mattress Speak + redirect: true + subdirectory: /sr + tag: Squornshellous + dataCollectionEnabled: true + dataCollectionType: always + - id: 42e63e98c9a982ac9b8b743 + workspaceId: 42e63fc8c9a982ac9b8b746 + createdOn: '1982-10-12T12:00:00Z' + displayName: Vogon Poetry Archive + shortName: vogon-poetry + lastPublished: '2023-04-02T12:50:00Z' + lastUpdated: '2016-10-24T19:43:17Z' + previewUrl: >- + https://d1otoma47x30pg.cloudfront.net/42e63e98c9a982ac9b8b743/198210121200.png + timeZone: Vogsphere/PoetryHall + parentFolderId: 1as2d3f4g5h6j7k8l9z0x1c2v3b4n5m6 + customDomains: + - id: 589a331aa51e760df7ccb8a0 + url: vogonpoetry.galaxy + locales: + primary: + id: 653fd9af6a07fc9cfd7a5e55 + cmsLocaleId: 653ad57de882f528b32e810d + enabled: true + displayName: English - Vogon Verse + redirect: false + subdirectory: /en + tag: Third Worst Poetry + secondary: + - id: 653fd9af6a07fc9cfd7a5e54 + cmsLocaleId: 653ad57de882f528b32e810c + enabled: true + displayName: Galactic - Universal Language + redirect: true + subdirectory: /gl + tag: Pan-Galactic Gargle Blaster + dataCollectionEnabled: true + dataCollectionType: always + get: + path: /sites/{site_id} + method: GET + auth: true + docs: | + Get details of a site. + + Required scope | `sites:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + display-name: Get Site + response: + docs: Request was successful + type: root.Site + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + response: + body: + id: 42e98c9a982ac9b8b742 + workspaceId: 42e63e98c9a982ac9b8b742 + createdOn: '1979-10-12T12:00:00Z' + displayName: The Hitchhiker's Guide to the Galaxy + shortName: hitchhikers-guide + lastPublished: '2023-04-02T12:42:00Z' + lastUpdated: '2023-04-02T12:42:00Z' + previewUrl: >- + https://screenshots.webflow.com/sites/6258612d1ee792848f805dcf/20231219211811_d5990556c743f33b7071300a03bf67e6.png + timeZone: Magrathea/FactoryFloor + parentFolderId: 1as2d3f4g5h6j7k8l9z0x1c2v3b4n5m6 + customDomains: + - id: 589a331aa51e760df7ccb89d + url: hitchhikersguide.galaxy + - id: 589a331aa51e760df7ccb89e + url: heartofgold.spaceship + locales: + primary: + id: 653fd9af6a07fc9cfd7a5e57 + cmsLocaleId: 653ad57de882f528b32e810e + enabled: false + displayName: English (United States) + displayImageId: displayImageId + redirect: true + subdirectory: '' + tag: en-US + secondary: + - id: 653fd9af6a07fc9cfd7a5e57 + cmsLocaleId: 653ad57de882f528b32e810e + enabled: false + displayName: English (United States) + redirect: true + subdirectory: '' + tag: en-US + dataCollectionEnabled: true + dataCollectionType: always + get-custom-domain: + path: /sites/{site_id}/custom_domains + method: GET + auth: true + docs: | + Get a list of all custom domains related to site. + + Required scope | `sites:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + display-name: Get Custom Domains + response: + docs: Request was successful + type: root.Domains + errors: + - root.UnauthorizedError + - root.ForbiddenError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + response: + body: + customDomains: + - id: 589a331aa51e760df7ccb89d + url: hitchhikersguide.galaxy + - id: 589a331aa51e760df7ccb89e + url: heartofgold.spaceship + publish: + path: /sites/{site_id}/publish + method: POST + auth: true + docs: > + Publishes a site to one or more more domains. + + + This endpoint has a limit of + one successful publish queue per minute. + + + Required scope | `sites:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + display-name: Publish Site + request: + name: SitesPublishRequest + body: + properties: + customDomains: + type: optional> + docs: Array of Custom Domain IDs to publish + publishToWebflowSubdomain: + type: optional + docs: Choice of whether to publish to the default Webflow Subdomain + default: false + content-type: application/json + response: + docs: Request accepted + type: SitesPublishResponse + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.ForbiddenError + - root.NotFoundError + - root.TooManyRequestsError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + request: {} + response: + body: + customDomains: + - id: 589a331aa51e760df7ccb89d + url: test-api-domain.com + publishToWebflowSubdomain: true + source: + openapi: ../../../referenced-specs/v2.yml + display-name: Sites +types: + SitesPublishResponse: + properties: + customDomains: + type: optional> + docs: Array of domains objects + publishToWebflowSubdomain: + type: optional + docs: Flag for publishing to webflow.io subdomain + default: false + source: + openapi: ../../../referenced-specs/v2.yml diff --git a/.mock/definition/sites/activityLogs.yml b/.mock/definition/sites/activityLogs.yml new file mode 100644 index 0000000..1e26411 --- /dev/null +++ b/.mock/definition/sites/activityLogs.yml @@ -0,0 +1,65 @@ +imports: + root: ../__package__.yml +service: + auth: false + base-path: '' + endpoints: + list: + path: /sites/{site_id}/activity_logs + method: GET + auth: true + docs: >- + Retrieve Activity Logs for a specific Site. Requires Site to be on an + Enterprise plan.

Required scope | `site_activity:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + display-name: Get Site Activity Logs + request: + name: ActivityLogsListRequest + query-parameters: + limit: + type: optional + docs: 'Maximum number of records to be returned (max limit: 100)' + offset: + type: optional + docs: >- + Offset used for pagination if the results have more than limit + records + response: + docs: A list of site activity logs + type: root.SiteActivityLogResponse + errors: + - root.ForbiddenError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + response: + body: + items: + - id: 654c16c7b229e56bcf26872d + createdOn: '2023-11-08T23:16:23Z' + lastUpdated: '2023-11-08T23:16:23Z' + event: cms_collection + resourceOperation: CREATED + user: + id: 6509cd56e90eec668b009712 + displayName: John Doe + resourceId: 654c16c7b229e56bcf26870c + resourceName: foo-bar + newValue: newValue + previousValue: previousValue + payload: + key: value + pagination: + limit: 25 + offset: 0 + total: 1 + source: + openapi: ../../../referenced-specs/v2.yml diff --git a/.mock/definition/sites/scripts.yml b/.mock/definition/sites/scripts.yml new file mode 100644 index 0000000..eef5e63 --- /dev/null +++ b/.mock/definition/sites/scripts.yml @@ -0,0 +1,228 @@ +imports: + root: ../__package__.yml +service: + auth: false + base-path: '' + endpoints: + get-custom-code: + path: /sites/{site_id}/custom_code + method: GET + auth: true + docs: > + Get all registered scripts that have been applied to a specific Site. + +
Access to this + endpoint requires a bearer token from a Data + Client App.
+ + + Required scope | `custom_code:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + display-name: Get Custom Code + response: + docs: Request was successful + type: root.ScriptApplyList + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + response: + body: + scripts: + - id: cms_slider + location: header + version: 1.0.0 + attributes: + my-attribute: some-value + - id: alert + location: header + version: 0.0.1 + attributes: + key: value + lastUpdated: '2022-10-26T00:28:54.191Z' + createdOn: '2022-10-26T00:28:54.191Z' + upsert-custom-code: + path: /sites/{site_id}/custom_code + method: PUT + auth: true + docs: > + Add a registered script to a Site. + + + In order to use the Custom Code APIs for Sites and Pages, Custom Code + Scripts must first be registered + + to a Site via the `registered_scripts` endpoints, and then applied to a + Site or Page using the appropriate + + `custom_code` endpoints. + +
Access to this + endpoint requires a bearer token from a Data + Client App.
+ + + Required scope | `custom_code:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + display-name: Add/Update Custom Code + request: + body: root.ScriptApplyList + content-type: application/json + response: + docs: Request was successful + type: root.ScriptApplyList + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + request: + scripts: + - id: cms_slider + location: header + version: 1.0.0 + attributes: + my-attribute: some-value + - id: alert + location: header + version: 0.0.1 + response: + body: + scripts: + - id: cms_slider + location: header + version: 1.0.0 + attributes: + my-attribute: some-value + - id: alert + location: header + version: 0.0.1 + attributes: + key: value + lastUpdated: lastUpdated + createdOn: createdOn + delete-custom-code: + path: /sites/{site_id}/custom_code + method: DELETE + auth: true + docs: > + Delete the custom code block that an app created for a Site + + +
Access to this + endpoint requires a bearer token from a Data + Client App.
+ + + Required scope | `custom_code:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + display-name: Delete Custom Code + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + list-custom-code-blocks: + path: /sites/{site_id}/custom_code/blocks + method: GET + auth: true + docs: > + Get all instances of Custom Code applied to a Site or Pages. + +
Access to this + endpoint requires a bearer token from a Data + Client App.
+ + + Required scope | `custom_code:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + display-name: List Custom Code Blocks + request: + name: ScriptsListCustomCodeBlocksRequest + query-parameters: + offset: + type: optional + docs: >- + Offset used for pagination if the results have more than limit + records + limit: + type: optional + docs: 'Maximum number of records to be returned (max limit: 100)' + response: + docs: Request was successful + type: root.ListCustomCodeBlocks + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + response: + body: + blocks: + - siteId: 6258612d1ee792848f805dcf + pageId: pageId + type: site + scripts: + - id: chartjs + location: header + version: 4.4.2 + attributes: + key: value + createdOn: '2024-04-03T16:49:15Z' + lastUpdated: '2024-04-03T16:49:15Z' + - siteId: 6390c49674a71f84b51a08d8 + pageId: 6419db964a9c43f6a3af6348 + type: page + scripts: + - id: id + location: header + version: version + createdOn: '2022-10-26T00:28:54Z' + lastUpdated: '2022-10-26T00:28:54Z' + pagination: + limit: 10 + offset: 0 + total: 1 + source: + openapi: ../../../referenced-specs/v2.yml diff --git a/.mock/definition/token.yml b/.mock/definition/token.yml new file mode 100644 index 0000000..17b1188 --- /dev/null +++ b/.mock/definition/token.yml @@ -0,0 +1,71 @@ +imports: + root: __package__.yml +service: + auth: false + base-path: '' + endpoints: + authorized-by: + path: /token/authorized_by + method: GET + auth: true + docs: | + Information about the Authorized User + + Required Scope | `authorized_user:read` + source: + openapi: ../../../referenced-specs/v2.yml + display-name: Get Authorization User Info + response: + docs: Request was successful + type: root.AuthorizedUser + errors: + - root.UnauthorizedError + - root.ForbiddenError + examples: + - response: + body: + id: 545bbecb7bdd6769632504a7 + email: some@email.com + firstName: Some + lastName: One + introspect: + path: /token/introspect + method: GET + auth: true + docs: > + Information about the authorization token + + Access to this endpoint requires a bearer token from a []>Data + Client App](/data/docs/getting-started-data-clients). + source: + openapi: ../../../referenced-specs/v2.yml + display-name: Get Authorization Info + response: + docs: Request was successful + type: root.Authorization + errors: + - root.UnauthorizedError + examples: + - response: + body: + authorization: + id: 55818d58616600637b9a5786 + createdOn: '2016-10-03T23:12:00Z' + lastUsed: '2016-10-10T21:41:12Z' + grantType: authorization_code + rateLimit: 60 + scope: assets:read,assets:write + authorizedTo: + siteIds: + - 62f3b1f7eafac55d0c64ef91 + workspaceIds: + - 52f3b1f7eafac55d0c64ef91 + userIds: + - 545bbecb7bdd6769632504a7 + application: + id: 55131cd036c09f7d07883dfc + description: My Amazing App + homepage: https://webflow.com + displayName: My Amazing App + source: + openapi: ../../../referenced-specs/v2.yml diff --git a/.mock/definition/users.yml b/.mock/definition/users.yml new file mode 100644 index 0000000..6c8b266 --- /dev/null +++ b/.mock/definition/users.yml @@ -0,0 +1,392 @@ +types: + UsersListRequestSort: + enum: + - value: CreatedOn + name: CreatedOnAscending + docs: Sorts users in ascending order based on their created date + - value: '-CreatedOn' + name: CreatedOnDescending + docs: Sorts users in descending order based on their created date + - value: Email + name: EmailAscending + docs: Sorts users in ascending order based on their email + - value: '-Email' + name: EmailDescending + docs: Sorts users in descending order based on their email + - value: Status + name: StatusAscending + docs: Sorts users in ascending order based on their status + - value: '-Status' + name: StatusDescending + docs: Sorts users in descending order based on their status + - value: LastLogin + name: LastLoginAscending + docs: Sorts users in ascending order based on their last login date + - value: '-LastLogin' + name: LastLoginDescending + docs: Sorts users in descending order based on their last login date + - value: UpdatedOn + name: UpdatedOnAscending + docs: Sorts users in ascending order based on their update date + - value: '-UpdatedOn' + name: UpdatedOnDescending + docs: Sorts users in descending order based on their update date + source: + openapi: ../../../referenced-specs/v2.yml + UsersUpdateRequestData: + properties: + name: + type: optional + docs: | + The name of the user + accept-privacy: + type: optional + docs: | + Boolean indicating if the user has accepted the privacy policy + accept-communications: + type: optional + docs: | + Boolean indicating if the user has accepted to receive communications + source: + openapi: ../../../referenced-specs/v2.yml + inline: true +imports: + root: __package__.yml +service: + auth: false + base-path: '' + endpoints: + list: + path: /sites/{site_id}/users + method: GET + auth: true + docs: | + Get a list of users for a site + + Required scope | `users:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + display-name: List Users + request: + name: UsersListRequest + query-parameters: + offset: + type: optional + docs: >- + Offset used for pagination if the results have more than limit + records + limit: + type: optional + docs: 'Maximum number of records to be returned (max limit: 100)' + sort: + type: optional + docs: | + Sort string to use when ordering users + + Example(`CreatedOn`, `Email`, `Status`, `LastLogin`, `UpdatedOn`). + + Can be prefixed with a `-` to reverse the sort (ex. `-CreatedOn`) + response: + docs: Request was successful + type: root.UserList + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.ForbiddenError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + response: + body: + count: 5 + limit: 5 + offset: 0 + total: 201 + users: + - id: 6287ec36a841b25637c663df + isEmailVerified: false + lastUpdated: '2022-05-20T13:46:12Z' + invitedOn: '2016-10-24T19:41:29Z' + createdOn: '2022-05-20T13:46:12Z' + lastLogin: '2016-10-24T19:41:29Z' + status: unverified + accessGroups: + - slug: vogon-construction-crew + type: admin + - id: 6287ec36a841b25637c663f0 + isEmailVerified: false + lastUpdated: '2022-05-19T05:32:04Z' + invitedOn: '2016-10-24T19:41:29Z' + createdOn: '2022-05-19T05:32:04Z' + lastLogin: '2016-10-24T19:41:29Z' + status: unverified + accessGroups: + - slug: improbability-drive-test-subjects + type: admin + - id: 6287ec36a841b25637c663d9 + isEmailVerified: true + lastUpdated: '2022-05-17T03:34:06Z' + invitedOn: '2016-10-24T19:41:29Z' + createdOn: '2022-05-17T03:34:06Z' + lastLogin: '2016-10-24T19:41:29Z' + status: verified + accessGroups: + - slug: heart-of-gold-crew + type: admin + - id: 6287ec37a841b25637c6641b + isEmailVerified: false + lastUpdated: '2022-05-15T03:46:09Z' + invitedOn: '2016-10-24T19:41:29Z' + createdOn: '2022-05-15T03:46:09Z' + lastLogin: '2016-10-24T19:41:29Z' + status: unverified + accessGroups: + - slug: hitchhikers-guide-research-team + type: admin + - id: 6287ec37a841b25637c66449 + isEmailVerified: true + lastUpdated: '2022-05-15T02:55:38Z' + invitedOn: '2016-10-24T19:41:29Z' + createdOn: '2022-05-15T02:55:38Z' + lastLogin: '2016-10-24T19:41:29Z' + status: verified + accessGroups: + - slug: milliways-reservationists + type: admin + get: + path: /sites/{site_id}/users/{user_id} + method: GET + auth: true + docs: | + Get a User by ID + + Required scope | `users:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + user_id: + type: string + docs: Unique identifier for a User + display-name: Get User + response: + docs: Request was successful + type: root.User + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.ForbiddenError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + user_id: 580e63e98c9a982ac9b8b741 + response: + body: + id: 6287ec36a841b25637c663df + isEmailVerified: true + lastUpdated: '2022-05-20T13:46:12Z' + invitedOn: '2022-05-20T13:46:12Z' + createdOn: '2022-05-20T13:46:12Z' + lastLogin: '2022-05-20T13:46:12Z' + status: verified + accessGroups: + - slug: webflowers + type: admin + data: + data: + name: name + email: email + accept-privacy: true + accept-communications: true + additionalProperties: additionalProperties + delete: + path: /sites/{site_id}/users/{user_id} + method: DELETE + auth: true + docs: | + Delete a User by ID + + Required scope | `users:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + user_id: + type: string + docs: Unique identifier for a User + display-name: Delete User + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.ForbiddenError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + user_id: 580e63e98c9a982ac9b8b741 + update: + path: /sites/{site_id}/users/{user_id} + method: PATCH + auth: true + docs: | + Update a User by ID + + Required scope | `users:write` + + The email and password + fields cannot be updated using this endpoint + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + user_id: + type: string + docs: Unique identifier for a User + display-name: Update User + request: + name: UsersUpdateRequest + body: + properties: + data: optional + accessGroups: + type: optional> + docs: > + An array of access group slugs. Access groups are assigned to + the user as type `admin` and the user remains in the group until + removed. + content-type: application/json + response: + docs: Request was successful + type: root.User + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.ForbiddenError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + user_id: 580e63e98c9a982ac9b8b741 + request: + data: + name: Some One + accept-privacy: false + accept-communications: false + accessGroups: + - webflowers + - platinum + - free-tier + response: + body: + id: 6287ec36a841b25637c663df + isEmailVerified: true + lastUpdated: '2022-05-20T13:46:12Z' + invitedOn: '2022-05-20T13:46:12Z' + createdOn: '2022-05-20T13:46:12Z' + lastLogin: '2022-05-20T13:46:12Z' + status: verified + accessGroups: + - slug: webflowers + type: admin + data: + data: + name: name + email: email + accept-privacy: true + accept-communications: true + additionalProperties: additionalProperties + invite: + path: /sites/{site_id}/users/invite + method: POST + auth: true + docs: > + Create and invite a user with an email address. + + + The user will be sent and invite via email, which they will need to + accept in order to join paid any paid access group. + + + Required scope | `users:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + display-name: Create and Invite a User + request: + name: UsersInviteRequest + body: + properties: + email: + type: string + docs: Email address of user to send invite to + validation: + format: email + accessGroups: + type: optional> + docs: > + An array of access group slugs. Access groups are assigned to + the user as type `admin` and the user remains in the group until + removed. + content-type: application/json + response: + docs: Request was successful + type: root.User + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.ForbiddenError + - root.NotFoundError + - root.ConflictError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + request: + email: some.one@home.com + accessGroups: + - webflowers + response: + body: + id: 6287ec36a841b25637c663df + isEmailVerified: true + lastUpdated: '2022-05-20T13:46:12Z' + invitedOn: '2022-05-20T13:46:12Z' + createdOn: '2022-05-20T13:46:12Z' + lastLogin: '2022-05-20T13:46:12Z' + status: verified + accessGroups: + - slug: webflowers + type: admin + data: + data: + name: name + email: email + accept-privacy: true + accept-communications: true + additionalProperties: additionalProperties + source: + openapi: ../../../referenced-specs/v2.yml diff --git a/.mock/definition/webhooks.yml b/.mock/definition/webhooks.yml new file mode 100644 index 0000000..e32db3d --- /dev/null +++ b/.mock/definition/webhooks.yml @@ -0,0 +1,189 @@ +imports: + root: __package__.yml +service: + auth: false + base-path: '' + endpoints: + list: + path: /sites/{site_id}/webhooks + method: GET + auth: true + docs: | + List all App-created Webhooks registered for a given site + + Required scope | `sites:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + display-name: List Webhooks + response: + docs: Request was successful + type: root.WebhookList + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + response: + body: + pagination: + limit: 100 + offset: 0 + total: 100 + webhooks: + - id: 57ca0a9e418c504a6e1acbb6 + triggerType: form_submission + url: https://webhook.site/7f7f7f7f-7f7f-7f7f-7f7f-7f7f7f7f7f7f + workspaceId: 4f4e46fd476ea8c507000001 + siteId: 562ac0395358780a1f5e6fbd + filter: + name: Email Form + lastTriggered: '2023-02-08T23:59:28Z' + createdOn: '2016-09-02T23:26:22Z' + - id: 578d85cce0c47cd2865f4cf2 + triggerType: form_submission + url: https://webhook.site/7f7f7f7f-7f7f-7f7f-7f7f-7f7f7f7f7f7f + workspaceId: 4f4e46fd476ea8c507000001 + siteId: 562ac0395358780a1f5e6fbd + filter: + name: Email Form + lastTriggered: '2023-02-08T23:59:28Z' + createdOn: '2016-07-19T01:43:40Z' + - id: 578d85cce0c47cd2865f4cf3 + triggerType: form_submission + url: https://webhook.site/7f7f7f7f-7f7f-7f7f-7f7f-7f7f7f7f7f7f + workspaceId: 4f4e46fd476ea8c507000001 + siteId: 562ac0395358780a1f5e6fbd + filter: + name: Email Form + lastTriggered: '2023-02-08T23:59:28Z' + createdOn: '2016-07-19T01:43:40Z' + create: + path: /sites/{site_id}/webhooks + method: POST + auth: true + docs: > + Create a new Webhook. + + + Limit of 75 registrations per `triggerType`, per site. + +
Access to this + endpoint requires a bearer token from a Data + Client App.
+ + Required scope | `sites:write` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + site_id: + type: string + docs: Unique identifier for a Site + display-name: Create Webhook + request: + body: root.Webhook + content-type: application/json + response: + docs: Request was successful + type: root.Webhook + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + site_id: 580e63e98c9a982ac9b8b741 + request: + id: 582266e0cd48de0f0e3c6d8b + triggerType: form_submission + url: https://webhook.site/7f7f7f7f-7f7f-7f7f-7f7f-7f7f7f7f7f7f + workspaceId: 4f4e46fd476ea8c507000001 + siteId: 562ac0395358780a1f5e6fbd + lastTriggered: '2023-02-08T23:59:28Z' + createdOn: '2022-11-08T23:59:28Z' + response: + body: + id: 582266e0cd48de0f0e3c6d8b + triggerType: form_submission + url: https://webhook.site/7f7f7f7f-7f7f-7f7f-7f7f-7f7f7f7f7f7f + workspaceId: 4f4e46fd476ea8c507000001 + siteId: 562ac0395358780a1f5e6fbd + filter: + name: My Form + lastTriggered: '2023-02-08T23:59:28Z' + createdOn: '2022-11-08T23:59:28Z' + get: + path: /webhooks/{webhook_id} + method: GET + auth: true + docs: | + Get a specific Webhook instance + + Required scope: `sites:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + webhook_id: + type: string + docs: Unique identifier for a Webhook + display-name: Get Webhook + response: + docs: Request was successful + type: root.Webhook + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + webhook_id: 580e64008c9a982ac9b8b754 + response: + body: + id: 582266e0cd48de0f0e3c6d8b + triggerType: form_submission + url: https://webhook.site/7f7f7f7f-7f7f-7f7f-7f7f-7f7f7f7f7f7f + workspaceId: 4f4e46fd476ea8c507000001 + siteId: 562ac0395358780a1f5e6fbd + filter: + name: My Form + lastTriggered: '2023-02-08T23:59:28Z' + createdOn: '2022-11-08T23:59:28Z' + delete: + path: /webhooks/{webhook_id} + method: DELETE + auth: true + docs: | + Remove a Webhook + + Required scope: `sites:read` + source: + openapi: ../../../referenced-specs/v2.yml + path-parameters: + webhook_id: + type: string + docs: Unique identifier for a Webhook + display-name: Remove Webhook + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + - root.TooManyRequestsError + - root.InternalServerError + examples: + - path-parameters: + webhook_id: 580e64008c9a982ac9b8b754 + source: + openapi: ../../../referenced-specs/v2.yml + display-name: Webhooks diff --git a/.mock/fern.config.json b/.mock/fern.config.json new file mode 100644 index 0000000..757dd2f --- /dev/null +++ b/.mock/fern.config.json @@ -0,0 +1,4 @@ +{ + "organization" : "webflow", + "version" : "0.45.3" +} \ No newline at end of file diff --git a/poetry.lock b/poetry.lock index a257797..a8ea763 100644 --- a/poetry.lock +++ b/poetry.lock @@ -16,13 +16,13 @@ typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.9\""} [[package]] name = "anyio" -version = "4.4.0" +version = "4.5.2" description = "High level compatibility layer for multiple asynchronous event loop implementations" optional = false python-versions = ">=3.8" files = [ - {file = "anyio-4.4.0-py3-none-any.whl", hash = "sha256:c1b2d8f46a8a812513012e1107cb0e68c17159a7a594208005a57dc776e1bdc7"}, - {file = "anyio-4.4.0.tar.gz", hash = "sha256:5aadc6a1bbb7cdb0bede386cac5e2940f5e2ff3aa20277e991cf028e0585ce94"}, + {file = "anyio-4.5.2-py3-none-any.whl", hash = "sha256:c011ee36bc1e8ba40e5a81cb9df91925c218fe9b778554e0b56a21e1b5d4716f"}, + {file = "anyio-4.5.2.tar.gz", hash = "sha256:23009af4ed04ce05991845451e11ef02fc7c5ed29179ac9a420e5ad0ac7ddc5b"}, ] [package.dependencies] @@ -32,19 +32,19 @@ sniffio = ">=1.1" typing-extensions = {version = ">=4.1", markers = "python_version < \"3.11\""} [package.extras] -doc = ["Sphinx (>=7)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme"] -test = ["anyio[trio]", "coverage[toml] (>=7)", "exceptiongroup (>=1.2.0)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "uvloop (>=0.17)"] -trio = ["trio (>=0.23)"] +doc = ["Sphinx (>=7.4,<8.0)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme"] +test = ["anyio[trio]", "coverage[toml] (>=7)", "exceptiongroup (>=1.2.0)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "truststore (>=0.9.1)", "uvloop (>=0.21.0b1)"] +trio = ["trio (>=0.26.1)"] [[package]] name = "certifi" -version = "2024.6.2" +version = "2024.12.14" description = "Python package for providing Mozilla's CA Bundle." optional = false python-versions = ">=3.6" files = [ - {file = "certifi-2024.6.2-py3-none-any.whl", hash = "sha256:ddc6c8ce995e6987e7faf5e3f1b02b302836a0e5d98ece18392cb1a36c72ad56"}, - {file = "certifi-2024.6.2.tar.gz", hash = "sha256:3cd43f1c6fa7dedc5899d69d3ad0398fd018ad1a17fba83ddaf78aa46c747516"}, + {file = "certifi-2024.12.14-py3-none-any.whl", hash = "sha256:1275f7a45be9464efc1173084eaa30f866fe2e47d389406136d332ed4967ec56"}, + {file = "certifi-2024.12.14.tar.gz", hash = "sha256:b650d30f370c2b724812bee08008be0c4163b163ddaec3f2546c1caf65f191db"}, ] [[package]] @@ -60,13 +60,13 @@ files = [ [[package]] name = "exceptiongroup" -version = "1.2.1" +version = "1.2.2" description = "Backport of PEP 654 (exception groups)" optional = false python-versions = ">=3.7" files = [ - {file = "exceptiongroup-1.2.1-py3-none-any.whl", hash = "sha256:5258b9ed329c5bbdd31a309f53cbfb0b155341807f6ff7606a1e801a891b29ad"}, - {file = "exceptiongroup-1.2.1.tar.gz", hash = "sha256:a4785e48b045528f5bfe627b6ad554ff32def154f42372786903b7abcfe1aa16"}, + {file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"}, + {file = "exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc"}, ] [package.extras] @@ -85,13 +85,13 @@ files = [ [[package]] name = "httpcore" -version = "1.0.5" +version = "1.0.7" description = "A minimal low-level HTTP client." optional = false python-versions = ">=3.8" files = [ - {file = "httpcore-1.0.5-py3-none-any.whl", hash = "sha256:421f18bac248b25d310f3cacd198d55b8e6125c107797b609ff9b7a6ba7991b5"}, - {file = "httpcore-1.0.5.tar.gz", hash = "sha256:34a38e2f9291467ee3b44e89dd52615370e152954ba21721378a87b2960f7a61"}, + {file = "httpcore-1.0.7-py3-none-any.whl", hash = "sha256:a3fff8f43dc260d5bd363d9f9cf1830fa3a458b332856f34282de498ed420edd"}, + {file = "httpcore-1.0.7.tar.gz", hash = "sha256:8551cb62a169ec7162ac7be8d4817d561f60e08eaa485234898414bb5a8a0b4c"}, ] [package.dependencies] @@ -102,17 +102,17 @@ h11 = ">=0.13,<0.15" asyncio = ["anyio (>=4.0,<5.0)"] http2 = ["h2 (>=3,<5)"] socks = ["socksio (==1.*)"] -trio = ["trio (>=0.22.0,<0.26.0)"] +trio = ["trio (>=0.22.0,<1.0)"] [[package]] name = "httpx" -version = "0.27.0" +version = "0.28.1" description = "The next generation HTTP client." optional = false python-versions = ">=3.8" files = [ - {file = "httpx-0.27.0-py3-none-any.whl", hash = "sha256:71d5465162c13681bff01ad59b2cc68dd838ea1f10e51574bac27103f00c91a5"}, - {file = "httpx-0.27.0.tar.gz", hash = "sha256:a0cb88a46f32dc874e04ee956e4c2764aba2aa228f650b06788ba6bda2962ab5"}, + {file = "httpx-0.28.1-py3-none-any.whl", hash = "sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad"}, + {file = "httpx-0.28.1.tar.gz", hash = "sha256:75e98c5f16b0f35b567856f597f06ff2270a374470a5c2392242528e3e3e42fc"}, ] [package.dependencies] @@ -120,25 +120,28 @@ anyio = "*" certifi = "*" httpcore = "==1.*" idna = "*" -sniffio = "*" [package.extras] brotli = ["brotli", "brotlicffi"] cli = ["click (==8.*)", "pygments (==2.*)", "rich (>=10,<14)"] http2 = ["h2 (>=3,<5)"] socks = ["socksio (==1.*)"] +zstd = ["zstandard (>=0.18.0)"] [[package]] name = "idna" -version = "3.7" +version = "3.10" description = "Internationalized Domain Names in Applications (IDNA)" optional = false -python-versions = ">=3.5" +python-versions = ">=3.6" files = [ - {file = "idna-3.7-py3-none-any.whl", hash = "sha256:82fee1fc78add43492d3a1898bfa6d8a904cc97d8427f683ed8e798d07761aa0"}, - {file = "idna-3.7.tar.gz", hash = "sha256:028ff3aadf0609c1fd278d8ea3089299412a7a8b9bd005dd08b9f8285bcb5cfc"}, + {file = "idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3"}, + {file = "idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9"}, ] +[package.extras] +all = ["flake8 (>=7.1.1)", "mypy (>=1.11.2)", "pytest (>=8.3.2)", "ruff (>=0.6.2)"] + [[package]] name = "iniconfig" version = "2.0.0" @@ -209,13 +212,13 @@ files = [ [[package]] name = "packaging" -version = "24.1" +version = "24.2" description = "Core utilities for Python packages" optional = false python-versions = ">=3.8" files = [ - {file = "packaging-24.1-py3-none-any.whl", hash = "sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124"}, - {file = "packaging-24.1.tar.gz", hash = "sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002"}, + {file = "packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759"}, + {file = "packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f"}, ] [[package]] @@ -235,109 +238,131 @@ testing = ["pytest", "pytest-benchmark"] [[package]] name = "pydantic" -version = "2.7.4" +version = "2.10.3" description = "Data validation using Python type hints" optional = false python-versions = ">=3.8" files = [ - {file = "pydantic-2.7.4-py3-none-any.whl", hash = "sha256:ee8538d41ccb9c0a9ad3e0e5f07bf15ed8015b481ced539a1759d8cc89ae90d0"}, - {file = "pydantic-2.7.4.tar.gz", hash = "sha256:0c84efd9548d545f63ac0060c1e4d39bb9b14db8b3c0652338aecc07b5adec52"}, + {file = "pydantic-2.10.3-py3-none-any.whl", hash = "sha256:be04d85bbc7b65651c5f8e6b9976ed9c6f41782a55524cef079a34a0bb82144d"}, + {file = "pydantic-2.10.3.tar.gz", hash = "sha256:cb5ac360ce894ceacd69c403187900a02c4b20b693a9dd1d643e1effab9eadf9"}, ] [package.dependencies] -annotated-types = ">=0.4.0" -pydantic-core = "2.18.4" -typing-extensions = ">=4.6.1" +annotated-types = ">=0.6.0" +pydantic-core = "2.27.1" +typing-extensions = ">=4.12.2" [package.extras] email = ["email-validator (>=2.0.0)"] +timezone = ["tzdata"] [[package]] name = "pydantic-core" -version = "2.18.4" +version = "2.27.1" description = "Core functionality for Pydantic validation and serialization" optional = false python-versions = ">=3.8" files = [ - {file = "pydantic_core-2.18.4-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:f76d0ad001edd426b92233d45c746fd08f467d56100fd8f30e9ace4b005266e4"}, - {file = "pydantic_core-2.18.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:59ff3e89f4eaf14050c8022011862df275b552caef8082e37b542b066ce1ff26"}, - {file = "pydantic_core-2.18.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a55b5b16c839df1070bc113c1f7f94a0af4433fcfa1b41799ce7606e5c79ce0a"}, - {file = "pydantic_core-2.18.4-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:4d0dcc59664fcb8974b356fe0a18a672d6d7cf9f54746c05f43275fc48636851"}, - {file = "pydantic_core-2.18.4-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8951eee36c57cd128f779e641e21eb40bc5073eb28b2d23f33eb0ef14ffb3f5d"}, - {file = "pydantic_core-2.18.4-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4701b19f7e3a06ea655513f7938de6f108123bf7c86bbebb1196eb9bd35cf724"}, - {file = "pydantic_core-2.18.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e00a3f196329e08e43d99b79b286d60ce46bed10f2280d25a1718399457e06be"}, - {file = "pydantic_core-2.18.4-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:97736815b9cc893b2b7f663628e63f436018b75f44854c8027040e05230eeddb"}, - {file = "pydantic_core-2.18.4-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:6891a2ae0e8692679c07728819b6e2b822fb30ca7445f67bbf6509b25a96332c"}, - {file = "pydantic_core-2.18.4-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:bc4ff9805858bd54d1a20efff925ccd89c9d2e7cf4986144b30802bf78091c3e"}, - {file = "pydantic_core-2.18.4-cp310-none-win32.whl", hash = "sha256:1b4de2e51bbcb61fdebd0ab86ef28062704f62c82bbf4addc4e37fa4b00b7cbc"}, - {file = "pydantic_core-2.18.4-cp310-none-win_amd64.whl", hash = "sha256:6a750aec7bf431517a9fd78cb93c97b9b0c496090fee84a47a0d23668976b4b0"}, - {file = "pydantic_core-2.18.4-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:942ba11e7dfb66dc70f9ae66b33452f51ac7bb90676da39a7345e99ffb55402d"}, - {file = "pydantic_core-2.18.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:b2ebef0e0b4454320274f5e83a41844c63438fdc874ea40a8b5b4ecb7693f1c4"}, - {file = "pydantic_core-2.18.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a642295cd0c8df1b86fc3dced1d067874c353a188dc8e0f744626d49e9aa51c4"}, - {file = "pydantic_core-2.18.4-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5f09baa656c904807e832cf9cce799c6460c450c4ad80803517032da0cd062e2"}, - {file = "pydantic_core-2.18.4-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:98906207f29bc2c459ff64fa007afd10a8c8ac080f7e4d5beff4c97086a3dabd"}, - {file = "pydantic_core-2.18.4-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:19894b95aacfa98e7cb093cd7881a0c76f55731efad31073db4521e2b6ff5b7d"}, - {file = "pydantic_core-2.18.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0fbbdc827fe5e42e4d196c746b890b3d72876bdbf160b0eafe9f0334525119c8"}, - {file = "pydantic_core-2.18.4-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f85d05aa0918283cf29a30b547b4df2fbb56b45b135f9e35b6807cb28bc47951"}, - {file = "pydantic_core-2.18.4-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:e85637bc8fe81ddb73fda9e56bab24560bdddfa98aa64f87aaa4e4b6730c23d2"}, - {file = "pydantic_core-2.18.4-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:2f5966897e5461f818e136b8451d0551a2e77259eb0f73a837027b47dc95dab9"}, - {file = "pydantic_core-2.18.4-cp311-none-win32.whl", hash = "sha256:44c7486a4228413c317952e9d89598bcdfb06399735e49e0f8df643e1ccd0558"}, - {file = "pydantic_core-2.18.4-cp311-none-win_amd64.whl", hash = "sha256:8a7164fe2005d03c64fd3b85649891cd4953a8de53107940bf272500ba8a788b"}, - {file = "pydantic_core-2.18.4-cp311-none-win_arm64.whl", hash = "sha256:4e99bc050fe65c450344421017f98298a97cefc18c53bb2f7b3531eb39bc7805"}, - {file = "pydantic_core-2.18.4-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:6f5c4d41b2771c730ea1c34e458e781b18cc668d194958e0112455fff4e402b2"}, - {file = "pydantic_core-2.18.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:2fdf2156aa3d017fddf8aea5adfba9f777db1d6022d392b682d2a8329e087cef"}, - {file = "pydantic_core-2.18.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4748321b5078216070b151d5271ef3e7cc905ab170bbfd27d5c83ee3ec436695"}, - {file = "pydantic_core-2.18.4-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:847a35c4d58721c5dc3dba599878ebbdfd96784f3fb8bb2c356e123bdcd73f34"}, - {file = "pydantic_core-2.18.4-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3c40d4eaad41f78e3bbda31b89edc46a3f3dc6e171bf0ecf097ff7a0ffff7cb1"}, - {file = "pydantic_core-2.18.4-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:21a5e440dbe315ab9825fcd459b8814bb92b27c974cbc23c3e8baa2b76890077"}, - {file = "pydantic_core-2.18.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:01dd777215e2aa86dfd664daed5957704b769e726626393438f9c87690ce78c3"}, - {file = "pydantic_core-2.18.4-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:4b06beb3b3f1479d32befd1f3079cc47b34fa2da62457cdf6c963393340b56e9"}, - {file = "pydantic_core-2.18.4-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:564d7922e4b13a16b98772441879fcdcbe82ff50daa622d681dd682175ea918c"}, - {file = "pydantic_core-2.18.4-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:0eb2a4f660fcd8e2b1c90ad566db2b98d7f3f4717c64fe0a83e0adb39766d5b8"}, - {file = "pydantic_core-2.18.4-cp312-none-win32.whl", hash = "sha256:8b8bab4c97248095ae0c4455b5a1cd1cdd96e4e4769306ab19dda135ea4cdb07"}, - {file = "pydantic_core-2.18.4-cp312-none-win_amd64.whl", hash = "sha256:14601cdb733d741b8958224030e2bfe21a4a881fb3dd6fbb21f071cabd48fa0a"}, - {file = "pydantic_core-2.18.4-cp312-none-win_arm64.whl", hash = "sha256:c1322d7dd74713dcc157a2b7898a564ab091ca6c58302d5c7b4c07296e3fd00f"}, - {file = "pydantic_core-2.18.4-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:823be1deb01793da05ecb0484d6c9e20baebb39bd42b5d72636ae9cf8350dbd2"}, - {file = "pydantic_core-2.18.4-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:ebef0dd9bf9b812bf75bda96743f2a6c5734a02092ae7f721c048d156d5fabae"}, - {file = "pydantic_core-2.18.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ae1d6df168efb88d7d522664693607b80b4080be6750c913eefb77e34c12c71a"}, - {file = "pydantic_core-2.18.4-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:f9899c94762343f2cc2fc64c13e7cae4c3cc65cdfc87dd810a31654c9b7358cc"}, - {file = "pydantic_core-2.18.4-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:99457f184ad90235cfe8461c4d70ab7dd2680e28821c29eca00252ba90308c78"}, - {file = "pydantic_core-2.18.4-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:18f469a3d2a2fdafe99296a87e8a4c37748b5080a26b806a707f25a902c040a8"}, - {file = "pydantic_core-2.18.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b7cdf28938ac6b8b49ae5e92f2735056a7ba99c9b110a474473fd71185c1af5d"}, - {file = "pydantic_core-2.18.4-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:938cb21650855054dc54dfd9120a851c974f95450f00683399006aa6e8abb057"}, - {file = "pydantic_core-2.18.4-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:44cd83ab6a51da80fb5adbd9560e26018e2ac7826f9626bc06ca3dc074cd198b"}, - {file = "pydantic_core-2.18.4-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:972658f4a72d02b8abfa2581d92d59f59897d2e9f7e708fdabe922f9087773af"}, - {file = "pydantic_core-2.18.4-cp38-none-win32.whl", hash = "sha256:1d886dc848e60cb7666f771e406acae54ab279b9f1e4143babc9c2258213daa2"}, - {file = "pydantic_core-2.18.4-cp38-none-win_amd64.whl", hash = "sha256:bb4462bd43c2460774914b8525f79b00f8f407c945d50881568f294c1d9b4443"}, - {file = "pydantic_core-2.18.4-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:44a688331d4a4e2129140a8118479443bd6f1905231138971372fcde37e43528"}, - {file = "pydantic_core-2.18.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:a2fdd81edd64342c85ac7cf2753ccae0b79bf2dfa063785503cb85a7d3593223"}, - {file = "pydantic_core-2.18.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:86110d7e1907ab36691f80b33eb2da87d780f4739ae773e5fc83fb272f88825f"}, - {file = "pydantic_core-2.18.4-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:46387e38bd641b3ee5ce247563b60c5ca098da9c56c75c157a05eaa0933ed154"}, - {file = "pydantic_core-2.18.4-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:123c3cec203e3f5ac7b000bd82235f1a3eced8665b63d18be751f115588fea30"}, - {file = "pydantic_core-2.18.4-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:dc1803ac5c32ec324c5261c7209e8f8ce88e83254c4e1aebdc8b0a39f9ddb443"}, - {file = "pydantic_core-2.18.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:53db086f9f6ab2b4061958d9c276d1dbe3690e8dd727d6abf2321d6cce37fa94"}, - {file = "pydantic_core-2.18.4-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:abc267fa9837245cc28ea6929f19fa335f3dc330a35d2e45509b6566dc18be23"}, - {file = "pydantic_core-2.18.4-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:a0d829524aaefdebccb869eed855e2d04c21d2d7479b6cada7ace5448416597b"}, - {file = "pydantic_core-2.18.4-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:509daade3b8649f80d4e5ff21aa5673e4ebe58590b25fe42fac5f0f52c6f034a"}, - {file = "pydantic_core-2.18.4-cp39-none-win32.whl", hash = "sha256:ca26a1e73c48cfc54c4a76ff78df3727b9d9f4ccc8dbee4ae3f73306a591676d"}, - {file = "pydantic_core-2.18.4-cp39-none-win_amd64.whl", hash = "sha256:c67598100338d5d985db1b3d21f3619ef392e185e71b8d52bceacc4a7771ea7e"}, - {file = "pydantic_core-2.18.4-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:574d92eac874f7f4db0ca653514d823a0d22e2354359d0759e3f6a406db5d55d"}, - {file = "pydantic_core-2.18.4-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:1f4d26ceb5eb9eed4af91bebeae4b06c3fb28966ca3a8fb765208cf6b51102ab"}, - {file = "pydantic_core-2.18.4-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:77450e6d20016ec41f43ca4a6c63e9fdde03f0ae3fe90e7c27bdbeaece8b1ed4"}, - {file = "pydantic_core-2.18.4-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d323a01da91851a4f17bf592faf46149c9169d68430b3146dcba2bb5e5719abc"}, - {file = "pydantic_core-2.18.4-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:43d447dd2ae072a0065389092a231283f62d960030ecd27565672bd40746c507"}, - {file = "pydantic_core-2.18.4-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:578e24f761f3b425834f297b9935e1ce2e30f51400964ce4801002435a1b41ef"}, - {file = "pydantic_core-2.18.4-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:81b5efb2f126454586d0f40c4d834010979cb80785173d1586df845a632e4e6d"}, - {file = "pydantic_core-2.18.4-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:ab86ce7c8f9bea87b9d12c7f0af71102acbf5ecbc66c17796cff45dae54ef9a5"}, - {file = "pydantic_core-2.18.4-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:90afc12421df2b1b4dcc975f814e21bc1754640d502a2fbcc6d41e77af5ec312"}, - {file = "pydantic_core-2.18.4-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:51991a89639a912c17bef4b45c87bd83593aee0437d8102556af4885811d59f5"}, - {file = "pydantic_core-2.18.4-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:293afe532740370aba8c060882f7d26cfd00c94cae32fd2e212a3a6e3b7bc15e"}, - {file = "pydantic_core-2.18.4-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b48ece5bde2e768197a2d0f6e925f9d7e3e826f0ad2271120f8144a9db18d5c8"}, - {file = "pydantic_core-2.18.4-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:eae237477a873ab46e8dd748e515c72c0c804fb380fbe6c85533c7de51f23a8f"}, - {file = "pydantic_core-2.18.4-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:834b5230b5dfc0c1ec37b2fda433b271cbbc0e507560b5d1588e2cc1148cf1ce"}, - {file = "pydantic_core-2.18.4-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:e858ac0a25074ba4bce653f9b5d0a85b7456eaddadc0ce82d3878c22489fa4ee"}, - {file = "pydantic_core-2.18.4-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:2fd41f6eff4c20778d717af1cc50eca52f5afe7805ee530a4fbd0bae284f16e9"}, - {file = "pydantic_core-2.18.4.tar.gz", hash = "sha256:ec3beeada09ff865c344ff3bc2f427f5e6c26401cc6113d77e372c3fdac73864"}, + {file = "pydantic_core-2.27.1-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:71a5e35c75c021aaf400ac048dacc855f000bdfed91614b4a726f7432f1f3d6a"}, + {file = "pydantic_core-2.27.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:f82d068a2d6ecfc6e054726080af69a6764a10015467d7d7b9f66d6ed5afa23b"}, + {file = "pydantic_core-2.27.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:121ceb0e822f79163dd4699e4c54f5ad38b157084d97b34de8b232bcaad70278"}, + {file = "pydantic_core-2.27.1-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:4603137322c18eaf2e06a4495f426aa8d8388940f3c457e7548145011bb68e05"}, + {file = "pydantic_core-2.27.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a33cd6ad9017bbeaa9ed78a2e0752c5e250eafb9534f308e7a5f7849b0b1bfb4"}, + {file = "pydantic_core-2.27.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:15cc53a3179ba0fcefe1e3ae50beb2784dede4003ad2dfd24f81bba4b23a454f"}, + {file = "pydantic_core-2.27.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:45d9c5eb9273aa50999ad6adc6be5e0ecea7e09dbd0d31bd0c65a55a2592ca08"}, + {file = "pydantic_core-2.27.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:8bf7b66ce12a2ac52d16f776b31d16d91033150266eb796967a7e4621707e4f6"}, + {file = "pydantic_core-2.27.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:655d7dd86f26cb15ce8a431036f66ce0318648f8853d709b4167786ec2fa4807"}, + {file = "pydantic_core-2.27.1-cp310-cp310-musllinux_1_1_armv7l.whl", hash = "sha256:5556470f1a2157031e676f776c2bc20acd34c1990ca5f7e56f1ebf938b9ab57c"}, + {file = "pydantic_core-2.27.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:f69ed81ab24d5a3bd93861c8c4436f54afdf8e8cc421562b0c7504cf3be58206"}, + {file = "pydantic_core-2.27.1-cp310-none-win32.whl", hash = "sha256:f5a823165e6d04ccea61a9f0576f345f8ce40ed533013580e087bd4d7442b52c"}, + {file = "pydantic_core-2.27.1-cp310-none-win_amd64.whl", hash = "sha256:57866a76e0b3823e0b56692d1a0bf722bffb324839bb5b7226a7dbd6c9a40b17"}, + {file = "pydantic_core-2.27.1-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:ac3b20653bdbe160febbea8aa6c079d3df19310d50ac314911ed8cc4eb7f8cb8"}, + {file = "pydantic_core-2.27.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a5a8e19d7c707c4cadb8c18f5f60c843052ae83c20fa7d44f41594c644a1d330"}, + {file = "pydantic_core-2.27.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7f7059ca8d64fea7f238994c97d91f75965216bcbe5f695bb44f354893f11d52"}, + {file = "pydantic_core-2.27.1-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:bed0f8a0eeea9fb72937ba118f9db0cb7e90773462af7962d382445f3005e5a4"}, + {file = "pydantic_core-2.27.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a3cb37038123447cf0f3ea4c74751f6a9d7afef0eb71aa07bf5f652b5e6a132c"}, + {file = "pydantic_core-2.27.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:84286494f6c5d05243456e04223d5a9417d7f443c3b76065e75001beb26f88de"}, + {file = "pydantic_core-2.27.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:acc07b2cfc5b835444b44a9956846b578d27beeacd4b52e45489e93276241025"}, + {file = "pydantic_core-2.27.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:4fefee876e07a6e9aad7a8c8c9f85b0cdbe7df52b8a9552307b09050f7512c7e"}, + {file = "pydantic_core-2.27.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:258c57abf1188926c774a4c94dd29237e77eda19462e5bb901d88adcab6af919"}, + {file = "pydantic_core-2.27.1-cp311-cp311-musllinux_1_1_armv7l.whl", hash = "sha256:35c14ac45fcfdf7167ca76cc80b2001205a8d5d16d80524e13508371fb8cdd9c"}, + {file = "pydantic_core-2.27.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:d1b26e1dff225c31897696cab7d4f0a315d4c0d9e8666dbffdb28216f3b17fdc"}, + {file = "pydantic_core-2.27.1-cp311-none-win32.whl", hash = "sha256:2cdf7d86886bc6982354862204ae3b2f7f96f21a3eb0ba5ca0ac42c7b38598b9"}, + {file = "pydantic_core-2.27.1-cp311-none-win_amd64.whl", hash = "sha256:3af385b0cee8df3746c3f406f38bcbfdc9041b5c2d5ce3e5fc6637256e60bbc5"}, + {file = "pydantic_core-2.27.1-cp311-none-win_arm64.whl", hash = "sha256:81f2ec23ddc1b476ff96563f2e8d723830b06dceae348ce02914a37cb4e74b89"}, + {file = "pydantic_core-2.27.1-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:9cbd94fc661d2bab2bc702cddd2d3370bbdcc4cd0f8f57488a81bcce90c7a54f"}, + {file = "pydantic_core-2.27.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:5f8c4718cd44ec1580e180cb739713ecda2bdee1341084c1467802a417fe0f02"}, + {file = "pydantic_core-2.27.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:15aae984e46de8d376df515f00450d1522077254ef6b7ce189b38ecee7c9677c"}, + {file = "pydantic_core-2.27.1-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:1ba5e3963344ff25fc8c40da90f44b0afca8cfd89d12964feb79ac1411a260ac"}, + {file = "pydantic_core-2.27.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:992cea5f4f3b29d6b4f7f1726ed8ee46c8331c6b4eed6db5b40134c6fe1768bb"}, + {file = "pydantic_core-2.27.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:0325336f348dbee6550d129b1627cb8f5351a9dc91aad141ffb96d4937bd9529"}, + {file = "pydantic_core-2.27.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7597c07fbd11515f654d6ece3d0e4e5093edc30a436c63142d9a4b8e22f19c35"}, + {file = "pydantic_core-2.27.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:3bbd5d8cc692616d5ef6fbbbd50dbec142c7e6ad9beb66b78a96e9c16729b089"}, + {file = "pydantic_core-2.27.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:dc61505e73298a84a2f317255fcc72b710b72980f3a1f670447a21efc88f8381"}, + {file = "pydantic_core-2.27.1-cp312-cp312-musllinux_1_1_armv7l.whl", hash = "sha256:e1f735dc43da318cad19b4173dd1ffce1d84aafd6c9b782b3abc04a0d5a6f5bb"}, + {file = "pydantic_core-2.27.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:f4e5658dbffe8843a0f12366a4c2d1c316dbe09bb4dfbdc9d2d9cd6031de8aae"}, + {file = "pydantic_core-2.27.1-cp312-none-win32.whl", hash = "sha256:672ebbe820bb37988c4d136eca2652ee114992d5d41c7e4858cdd90ea94ffe5c"}, + {file = "pydantic_core-2.27.1-cp312-none-win_amd64.whl", hash = "sha256:66ff044fd0bb1768688aecbe28b6190f6e799349221fb0de0e6f4048eca14c16"}, + {file = "pydantic_core-2.27.1-cp312-none-win_arm64.whl", hash = "sha256:9a3b0793b1bbfd4146304e23d90045f2a9b5fd5823aa682665fbdaf2a6c28f3e"}, + {file = "pydantic_core-2.27.1-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:f216dbce0e60e4d03e0c4353c7023b202d95cbaeff12e5fd2e82ea0a66905073"}, + {file = "pydantic_core-2.27.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:a2e02889071850bbfd36b56fd6bc98945e23670773bc7a76657e90e6b6603c08"}, + {file = "pydantic_core-2.27.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:42b0e23f119b2b456d07ca91b307ae167cc3f6c846a7b169fca5326e32fdc6cf"}, + {file = "pydantic_core-2.27.1-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:764be71193f87d460a03f1f7385a82e226639732214b402f9aa61f0d025f0737"}, + {file = "pydantic_core-2.27.1-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1c00666a3bd2f84920a4e94434f5974d7bbc57e461318d6bb34ce9cdbbc1f6b2"}, + {file = "pydantic_core-2.27.1-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3ccaa88b24eebc0f849ce0a4d09e8a408ec5a94afff395eb69baf868f5183107"}, + {file = "pydantic_core-2.27.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c65af9088ac534313e1963443d0ec360bb2b9cba6c2909478d22c2e363d98a51"}, + {file = "pydantic_core-2.27.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:206b5cf6f0c513baffaeae7bd817717140770c74528f3e4c3e1cec7871ddd61a"}, + {file = "pydantic_core-2.27.1-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:062f60e512fc7fff8b8a9d680ff0ddaaef0193dba9fa83e679c0c5f5fbd018bc"}, + {file = "pydantic_core-2.27.1-cp313-cp313-musllinux_1_1_armv7l.whl", hash = "sha256:a0697803ed7d4af5e4c1adf1670af078f8fcab7a86350e969f454daf598c4960"}, + {file = "pydantic_core-2.27.1-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:58ca98a950171f3151c603aeea9303ef6c235f692fe555e883591103da709b23"}, + {file = "pydantic_core-2.27.1-cp313-none-win32.whl", hash = "sha256:8065914ff79f7eab1599bd80406681f0ad08f8e47c880f17b416c9f8f7a26d05"}, + {file = "pydantic_core-2.27.1-cp313-none-win_amd64.whl", hash = "sha256:ba630d5e3db74c79300d9a5bdaaf6200172b107f263c98a0539eeecb857b2337"}, + {file = "pydantic_core-2.27.1-cp313-none-win_arm64.whl", hash = "sha256:45cf8588c066860b623cd11c4ba687f8d7175d5f7ef65f7129df8a394c502de5"}, + {file = "pydantic_core-2.27.1-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:5897bec80a09b4084aee23f9b73a9477a46c3304ad1d2d07acca19723fb1de62"}, + {file = "pydantic_core-2.27.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:d0165ab2914379bd56908c02294ed8405c252250668ebcb438a55494c69f44ab"}, + {file = "pydantic_core-2.27.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6b9af86e1d8e4cfc82c2022bfaa6f459381a50b94a29e95dcdda8442d6d83864"}, + {file = "pydantic_core-2.27.1-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5f6c8a66741c5f5447e047ab0ba7a1c61d1e95580d64bce852e3df1f895c4067"}, + {file = "pydantic_core-2.27.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9a42d6a8156ff78981f8aa56eb6394114e0dedb217cf8b729f438f643608cbcd"}, + {file = "pydantic_core-2.27.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:64c65f40b4cd8b0e049a8edde07e38b476da7e3aaebe63287c899d2cff253fa5"}, + {file = "pydantic_core-2.27.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9fdcf339322a3fae5cbd504edcefddd5a50d9ee00d968696846f089b4432cf78"}, + {file = "pydantic_core-2.27.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:bf99c8404f008750c846cb4ac4667b798a9f7de673ff719d705d9b2d6de49c5f"}, + {file = "pydantic_core-2.27.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:8f1edcea27918d748c7e5e4d917297b2a0ab80cad10f86631e488b7cddf76a36"}, + {file = "pydantic_core-2.27.1-cp38-cp38-musllinux_1_1_armv7l.whl", hash = "sha256:159cac0a3d096f79ab6a44d77a961917219707e2a130739c64d4dd46281f5c2a"}, + {file = "pydantic_core-2.27.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:029d9757eb621cc6e1848fa0b0310310de7301057f623985698ed7ebb014391b"}, + {file = "pydantic_core-2.27.1-cp38-none-win32.whl", hash = "sha256:a28af0695a45f7060e6f9b7092558a928a28553366519f64083c63a44f70e618"}, + {file = "pydantic_core-2.27.1-cp38-none-win_amd64.whl", hash = "sha256:2d4567c850905d5eaaed2f7a404e61012a51caf288292e016360aa2b96ff38d4"}, + {file = "pydantic_core-2.27.1-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:e9386266798d64eeb19dd3677051f5705bf873e98e15897ddb7d76f477131967"}, + {file = "pydantic_core-2.27.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:4228b5b646caa73f119b1ae756216b59cc6e2267201c27d3912b592c5e323b60"}, + {file = "pydantic_core-2.27.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0b3dfe500de26c52abe0477dde16192ac39c98f05bf2d80e76102d394bd13854"}, + {file = "pydantic_core-2.27.1-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:aee66be87825cdf72ac64cb03ad4c15ffef4143dbf5c113f64a5ff4f81477bf9"}, + {file = "pydantic_core-2.27.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3b748c44bb9f53031c8cbc99a8a061bc181c1000c60a30f55393b6e9c45cc5bd"}, + {file = "pydantic_core-2.27.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5ca038c7f6a0afd0b2448941b6ef9d5e1949e999f9e5517692eb6da58e9d44be"}, + {file = "pydantic_core-2.27.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6e0bd57539da59a3e4671b90a502da9a28c72322a4f17866ba3ac63a82c4498e"}, + {file = "pydantic_core-2.27.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:ac6c2c45c847bbf8f91930d88716a0fb924b51e0c6dad329b793d670ec5db792"}, + {file = "pydantic_core-2.27.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:b94d4ba43739bbe8b0ce4262bcc3b7b9f31459ad120fb595627eaeb7f9b9ca01"}, + {file = "pydantic_core-2.27.1-cp39-cp39-musllinux_1_1_armv7l.whl", hash = "sha256:00e6424f4b26fe82d44577b4c842d7df97c20be6439e8e685d0d715feceb9fb9"}, + {file = "pydantic_core-2.27.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:38de0a70160dd97540335b7ad3a74571b24f1dc3ed33f815f0880682e6880131"}, + {file = "pydantic_core-2.27.1-cp39-none-win32.whl", hash = "sha256:7ccebf51efc61634f6c2344da73e366c75e735960b5654b63d7e6f69a5885fa3"}, + {file = "pydantic_core-2.27.1-cp39-none-win_amd64.whl", hash = "sha256:a57847b090d7892f123726202b7daa20df6694cbd583b67a592e856bff603d6c"}, + {file = "pydantic_core-2.27.1-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:3fa80ac2bd5856580e242dbc202db873c60a01b20309c8319b5c5986fbe53ce6"}, + {file = "pydantic_core-2.27.1-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:d950caa237bb1954f1b8c9227b5065ba6875ac9771bb8ec790d956a699b78676"}, + {file = "pydantic_core-2.27.1-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0e4216e64d203e39c62df627aa882f02a2438d18a5f21d7f721621f7a5d3611d"}, + {file = "pydantic_core-2.27.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:02a3d637bd387c41d46b002f0e49c52642281edacd2740e5a42f7017feea3f2c"}, + {file = "pydantic_core-2.27.1-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:161c27ccce13b6b0c8689418da3885d3220ed2eae2ea5e9b2f7f3d48f1d52c27"}, + {file = "pydantic_core-2.27.1-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:19910754e4cc9c63bc1c7f6d73aa1cfee82f42007e407c0f413695c2f7ed777f"}, + {file = "pydantic_core-2.27.1-pp310-pypy310_pp73-musllinux_1_1_armv7l.whl", hash = "sha256:e173486019cc283dc9778315fa29a363579372fe67045e971e89b6365cc035ed"}, + {file = "pydantic_core-2.27.1-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:af52d26579b308921b73b956153066481f064875140ccd1dfd4e77db89dbb12f"}, + {file = "pydantic_core-2.27.1-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:981fb88516bd1ae8b0cbbd2034678a39dedc98752f264ac9bc5839d3923fa04c"}, + {file = "pydantic_core-2.27.1-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:5fde892e6c697ce3e30c61b239330fc5d569a71fefd4eb6512fc6caec9dd9e2f"}, + {file = "pydantic_core-2.27.1-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:816f5aa087094099fff7edabb5e01cc370eb21aa1a1d44fe2d2aefdfb5599b31"}, + {file = "pydantic_core-2.27.1-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9c10c309e18e443ddb108f0ef64e8729363adbfd92d6d57beec680f6261556f3"}, + {file = "pydantic_core-2.27.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:98476c98b02c8e9b2eec76ac4156fd006628b1b2d0ef27e548ffa978393fd154"}, + {file = "pydantic_core-2.27.1-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:c3027001c28434e7ca5a6e1e527487051136aa81803ac812be51802150d880dd"}, + {file = "pydantic_core-2.27.1-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:7699b1df36a48169cdebda7ab5a2bac265204003f153b4bd17276153d997670a"}, + {file = "pydantic_core-2.27.1-pp39-pypy39_pp73-musllinux_1_1_armv7l.whl", hash = "sha256:1c39b07d90be6b48968ddc8c19e7585052088fd7ec8d568bb31ff64c70ae3c97"}, + {file = "pydantic_core-2.27.1-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:46ccfe3032b3915586e469d4972973f893c0a2bb65669194a5bdea9bacc088c2"}, + {file = "pydantic_core-2.27.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:62ba45e21cf6571d7f716d903b5b7b6d2617e2d5d67c0923dc47b9d41369f840"}, + {file = "pydantic_core-2.27.1.tar.gz", hash = "sha256:62a763352879b84aa31058fc931884055fd75089cccbd9d58bb6afd01141b235"}, ] [package.dependencies] @@ -367,13 +392,13 @@ testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "no [[package]] name = "pytest-asyncio" -version = "0.23.7" +version = "0.23.8" description = "Pytest support for asyncio" optional = false python-versions = ">=3.8" files = [ - {file = "pytest_asyncio-0.23.7-py3-none-any.whl", hash = "sha256:009b48127fbe44518a547bddd25611551b0e43ccdbf1e67d12479f569832c20b"}, - {file = "pytest_asyncio-0.23.7.tar.gz", hash = "sha256:5f5c72948f4c49e7db4f29f2521d4031f1c27f86e57b046126654083d4770268"}, + {file = "pytest_asyncio-0.23.8-py3-none-any.whl", hash = "sha256:50265d892689a5faefb84df80819d1ecef566eb3549cf915dfb33569359d1ce2"}, + {file = "pytest_asyncio-0.23.8.tar.gz", hash = "sha256:759b10b33a6dc61cce40a8bd5205e302978bbbcc00e279a8b61d9a6a3c82e4d3"}, ] [package.dependencies] @@ -399,13 +424,13 @@ six = ">=1.5" [[package]] name = "six" -version = "1.16.0" +version = "1.17.0" description = "Python 2 and 3 compatibility utilities" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" files = [ - {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, - {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, + {file = "six-1.17.0-py2.py3-none-any.whl", hash = "sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274"}, + {file = "six-1.17.0.tar.gz", hash = "sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81"}, ] [[package]] @@ -421,24 +446,54 @@ files = [ [[package]] name = "tomli" -version = "2.0.1" +version = "2.2.1" description = "A lil' TOML parser" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, - {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, + {file = "tomli-2.2.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249"}, + {file = "tomli-2.2.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6"}, + {file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a"}, + {file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6972ca9c9cc9f0acaa56a8ca1ff51e7af152a9f87fb64623e31d5c83700080ee"}, + {file = "tomli-2.2.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c954d2250168d28797dd4e3ac5cf812a406cd5a92674ee4c8f123c889786aa8e"}, + {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:8dd28b3e155b80f4d54beb40a441d366adcfe740969820caf156c019fb5c7ec4"}, + {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:e59e304978767a54663af13c07b3d1af22ddee3bb2fb0618ca1593e4f593a106"}, + {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:33580bccab0338d00994d7f16f4c4ec25b776af3ffaac1ed74e0b3fc95e885a8"}, + {file = "tomli-2.2.1-cp311-cp311-win32.whl", hash = "sha256:465af0e0875402f1d226519c9904f37254b3045fc5084697cefb9bdde1ff99ff"}, + {file = "tomli-2.2.1-cp311-cp311-win_amd64.whl", hash = "sha256:2d0f2fdd22b02c6d81637a3c95f8cd77f995846af7414c5c4b8d0545afa1bc4b"}, + {file = "tomli-2.2.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:4a8f6e44de52d5e6c657c9fe83b562f5f4256d8ebbfe4ff922c495620a7f6cea"}, + {file = "tomli-2.2.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8d57ca8095a641b8237d5b079147646153d22552f1c637fd3ba7f4b0b29167a8"}, + {file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4e340144ad7ae1533cb897d406382b4b6fede8890a03738ff1683af800d54192"}, + {file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:db2b95f9de79181805df90bedc5a5ab4c165e6ec3fe99f970d0e302f384ad222"}, + {file = "tomli-2.2.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:40741994320b232529c802f8bc86da4e1aa9f413db394617b9a256ae0f9a7f77"}, + {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:400e720fe168c0f8521520190686ef8ef033fb19fc493da09779e592861b78c6"}, + {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:02abe224de6ae62c19f090f68da4e27b10af2b93213d36cf44e6e1c5abd19fdd"}, + {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:b82ebccc8c8a36f2094e969560a1b836758481f3dc360ce9a3277c65f374285e"}, + {file = "tomli-2.2.1-cp312-cp312-win32.whl", hash = "sha256:889f80ef92701b9dbb224e49ec87c645ce5df3fa2cc548664eb8a25e03127a98"}, + {file = "tomli-2.2.1-cp312-cp312-win_amd64.whl", hash = "sha256:7fc04e92e1d624a4a63c76474610238576942d6b8950a2d7f908a340494e67e4"}, + {file = "tomli-2.2.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7"}, + {file = "tomli-2.2.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:286f0ca2ffeeb5b9bd4fcc8d6c330534323ec51b2f52da063b11c502da16f30c"}, + {file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a92ef1a44547e894e2a17d24e7557a5e85a9e1d0048b0b5e7541f76c5032cb13"}, + {file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9316dc65bed1684c9a98ee68759ceaed29d229e985297003e494aa825ebb0281"}, + {file = "tomli-2.2.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272"}, + {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:ac065718db92ca818f8d6141b5f66369833d4a80a9d74435a268c52bdfa73140"}, + {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:d920f33822747519673ee656a4b6ac33e382eca9d331c87770faa3eef562aeb2"}, + {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:a198f10c4d1b1375d7687bc25294306e551bf1abfa4eace6650070a5c1ae2744"}, + {file = "tomli-2.2.1-cp313-cp313-win32.whl", hash = "sha256:d3f5614314d758649ab2ab3a62d4f2004c825922f9e370b29416484086b264ec"}, + {file = "tomli-2.2.1-cp313-cp313-win_amd64.whl", hash = "sha256:a38aa0308e754b0e3c67e344754dff64999ff9b513e691d0e786265c93583c69"}, + {file = "tomli-2.2.1-py3-none-any.whl", hash = "sha256:cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc"}, + {file = "tomli-2.2.1.tar.gz", hash = "sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff"}, ] [[package]] name = "types-python-dateutil" -version = "2.9.0.20240316" +version = "2.9.0.20241206" description = "Typing stubs for python-dateutil" optional = false python-versions = ">=3.8" files = [ - {file = "types-python-dateutil-2.9.0.20240316.tar.gz", hash = "sha256:5d2f2e240b86905e40944dd787db6da9263f0deabef1076ddaed797351ec0202"}, - {file = "types_python_dateutil-2.9.0.20240316-py3-none-any.whl", hash = "sha256:6b8cb66d960771ce5ff974e9dd45e38facb81718cc1e208b10b1baccbfdbee3b"}, + {file = "types_python_dateutil-2.9.0.20241206-py3-none-any.whl", hash = "sha256:e248a4bc70a486d3e3ec84d0dc30eec3a5f979d6e7ee4123ae043eedbb987f53"}, + {file = "types_python_dateutil-2.9.0.20241206.tar.gz", hash = "sha256:18f493414c26ffba692a72369fea7a154c502646301ebfe3d56a04b3767284cb"}, ] [[package]] diff --git a/pyproject.toml b/pyproject.toml index ca24275..116c349 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "webflow" -version = "1.2.2" +version = "1.2.1" description = "" readme = "README.md" authors = [] diff --git a/reference.md b/reference.md index 5110fae..f64b70b 100644 --- a/reference.md +++ b/reference.md @@ -12,7 +12,9 @@
-Information about the Authorized User

Required Scope | `authorized_user:read` +Information about the Authorized User + +Required Scope | `authorized_user:read`
@@ -72,7 +74,8 @@ client.token.authorized_by()
-Information about the authorization token
Access to this endpoint requires a bearer token from a Data Client App.
+Information about the authorization token +Access to this endpoint requires a bearer token from a []>Data Client App](/data/docs/getting-started-data-clients).
@@ -133,7 +136,9 @@ client.token.introspect()
-List of all sites the provided access token is able to access.

Required scope | `sites:read` +List of all sites the provided access token is able to access. + +Required scope | `sites:read`
@@ -193,7 +198,9 @@ client.sites.list()
-Get a site by site id

Required scope | `sites:read` +Get details of a site. + +Required scope | `sites:read`
@@ -214,7 +221,7 @@ client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) client.sites.get( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) ``` @@ -263,7 +270,9 @@ client.sites.get(
-Get a list of all custom domains related to site.

Required scope | `sites:read` +Get a list of all custom domains related to site. + +Required scope | `sites:read`
@@ -284,7 +293,7 @@ client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) client.sites.get_custom_domain( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) ``` @@ -333,7 +342,11 @@ client.sites.get_custom_domain(
-Publish a site to one more more domains.

Required scope | `sites:write` +Publishes a site to one or more more domains. + +This endpoint has a limit of one successful publish queue per minute. + +Required scope | `sites:write`
@@ -354,7 +367,7 @@ client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) client.sites.publish( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) ``` @@ -379,7 +392,7 @@ client.sites.publish(
-**custom_domains:** `typing.Optional[typing.Sequence[str]]` — Array of Custom Domain ids to publish +**custom_domains:** `typing.Optional[typing.Sequence[str]]` — Array of Custom Domain IDs to publish
@@ -407,8 +420,8 @@ client.sites.publish( -## Sites ActivityLogs -
client.sites.activity_logs.list(...) +## Collections +
client.collections.list(...)
@@ -420,7 +433,9 @@ client.sites.publish(
-Retrieve Activity Logs for a specific Site. Requires Site to be on an Enterprise plan.

Required scope | `site_activity:read` +List of all Collections within a Site. + +Required scope | `cms:read`
@@ -440,8 +455,8 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.sites.activity_logs.list( - site_id="site_id", +client.collections.list( + site_id="580e63e98c9a982ac9b8b741", ) ``` @@ -466,22 +481,6 @@ client.sites.activity_logs.list(
-**limit:** `typing.Optional[float]` — Maximum number of records to be returned (max limit: 100) - -
-
- -
-
- -**offset:** `typing.Optional[float]` — Offset used for pagination if the results have more than limit records - -
-
- -
-
- **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -494,8 +493,7 @@ client.sites.activity_logs.list(
-## Collections -
client.collections.list(...) +
client.collections.create(...)
@@ -507,7 +505,9 @@ client.sites.activity_logs.list(
-List of all Collections within a Site.

Required scope | `cms:read` +Create a Collection for a site. + +Required scope | `cms:write`
@@ -527,8 +527,11 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.collections.list( - site_id="site_id", +client.collections.create( + site_id="580e63e98c9a982ac9b8b741", + display_name="Blog Posts", + singular_name="Blog Post", + slug="posts", ) ``` @@ -553,6 +556,30 @@ client.collections.list(
+**display_name:** `str` — Name of the collection. Each collection name must be distinct. + +
+
+ +
+
+ +**singular_name:** `str` — Singular name of each item. + +
+
+ +
+
+ +**slug:** `typing.Optional[str]` — Part of a URL that identifier + +
+
+ +
+
+ **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -565,7 +592,7 @@ client.collections.list(
-
client.collections.create(...) +
client.collections.get(...)
@@ -577,7 +604,9 @@ client.collections.list(
-Create a Collection for a site.

Required scope | `cms:write` +Get the full details of a collection from its ID. + +Required scope | `cms:read`
@@ -597,11 +626,8 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.collections.create( - site_id="site_id", - display_name="Blog Posts", - singular_name="Blog Post", - slug="posts", +client.collections.get( + collection_id="580e63fc8c9a982ac9b8b745", ) ``` @@ -618,31 +644,7 @@ client.collections.create(
-**site_id:** `str` — Unique identifier for a Site - -
-
- -
-
- -**display_name:** `str` — Name of the collection. Each collection name must be distinct. - -
-
- -
-
- -**singular_name:** `str` — Singular name of each item. - -
-
- -
-
- -**slug:** `typing.Optional[str]` — Part of a URL that identifier +**collection_id:** `str` — Unique identifier for a Collection
@@ -662,7 +664,7 @@ client.collections.create(
-
client.collections.get(...) +
client.collections.delete(...)
@@ -674,7 +676,9 @@ client.collections.create(
-Get the full details of a collection from its ID.

Required scope | `cms:read` +Delete a collection using its ID. + +Required scope | `cms:write`
@@ -694,8 +698,8 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.collections.get( - collection_id="collection_id", +client.collections.delete( + collection_id="580e63fc8c9a982ac9b8b745", ) ``` @@ -732,7 +736,8 @@ client.collections.get(
-
client.collections.delete_collection(...) +## Pages +
client.pages.list(...)
@@ -744,7 +749,9 @@ client.collections.get(
-Delete a collection using its ID.

Required scope | `cms:write` +List of all pages for a site. + +Required scope | `pages:read`
@@ -764,8 +771,9 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.collections.delete_collection( - collection_id="collection_id", +client.pages.list( + site_id="580e63e98c9a982ac9b8b741", + locale_id="65427cf400e02b306eaa04a0", ) ``` @@ -782,7 +790,31 @@ client.collections.delete_collection(
-**collection_id:** `str` — Unique identifier for a Collection +**site_id:** `str` — Unique identifier for a Site + +
+
+ +
+
+ +**locale_id:** `typing.Optional[str]` — Unique identifier for a specific locale. Applicable, when using localization. + +
+
+ +
+
+ +**limit:** `typing.Optional[float]` — Maximum number of records to be returned (max limit: 100) + +
+
+ +
+
+ +**offset:** `typing.Optional[float]` — Offset used for pagination if the results have more than limit records
@@ -802,7 +834,7 @@ client.collections.delete_collection(
-
client.collections.delete(...) +
client.pages.get_metadata(...)
@@ -814,7 +846,9 @@ client.collections.delete_collection(
-Delete a custom field in a collection. This endpoint does not currently support bulk deletion.

Required scope | `cms:write` +Get metadata information for a single page. + +Required scope | `pages:read`
@@ -834,9 +868,9 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.collections.delete( - collection_id="collection_id", - field_id="field_id", +client.pages.get_metadata( + page_id="63c720f9347c2139b248e552", + locale_id="65427cf400e02b306eaa04a0", ) ``` @@ -853,7 +887,7 @@ client.collections.delete(
-**collection_id:** `str` — Unique identifier for a Collection +**page_id:** `str` — Unique identifier for a Page
@@ -861,7 +895,7 @@ client.collections.delete(
-**field_id:** `str` — Unique identifier for a Field in a collection +**locale_id:** `typing.Optional[str]` — Unique identifier for a specific locale. Applicable, when using localization.
@@ -881,8 +915,7 @@ client.collections.delete(
-## Collections Fields -
client.collections.fields.create(...) +
client.pages.update_page_settings(...)
@@ -894,7 +927,9 @@ client.collections.delete(
-Create a custom field in a collection.

Slugs must be all lowercase letters without spaces. If you pass a string with uppercase letters and/or spaces to the "Slug" property, Webflow will convert the slug to lowercase and replace spaces with "-."

Only some field types can be created through the API. This endpoint does not currently support bulk creation.

Required scope | `cms:write` +Update Page-level metadata, including SEO and Open Graph fields. + +Required scope | `pages:write`
@@ -909,18 +944,43 @@ Create a custom field in a collection.

Slugs must be all lowercase le
```python +import datetime + +from webflow import PageOpenGraph, PageSeo from webflow.client import Webflow -from webflow.resources.collections import FieldCreateType client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.collections.fields.create( - collection_id="collection_id", - is_required=False, - type=FieldCreateType.RICH_TEXT, - display_name="Post Body", - help_text="Add the body of your post here", +client.pages.update_page_settings( + page_id="63c720f9347c2139b248e552", + locale_id="65427cf400e02b306eaa04a0", + id="6596da6045e56dee495bcbba", + site_id="6258612d1ee792848f805dcf", + title="Guide to the Galaxy", + slug="guide-to-the-galaxy", + created_on=datetime.datetime.fromisoformat( + "2024-03-11 10:42:00+00:00", + ), + last_updated=datetime.datetime.fromisoformat( + "2024-03-11 10:42:42+00:00", + ), + archived=False, + draft=False, + can_branch=True, + is_branch=False, + seo=PageSeo( + title="The Ultimate Hitchhiker's Guide to the Galaxy", + description="Everything you need to know about the galaxy, from avoiding Vogon poetry to the importance of towels.", + ), + open_graph=PageOpenGraph( + title="Explore the Cosmos with The Ultimate Guide", + title_copied=False, + description="Dive deep into the mysteries of the universe with your guide to everything galactic.", + description_copied=False, + ), + page_locale_id="653fd9af6a07fc9cfd7a5e57", + published_path="/en-us/guide-to-the-galaxy", ) ``` @@ -937,7 +997,7 @@ client.collections.fields.create(
-**collection_id:** `str` — Unique identifier for a Collection +**page_id:** `str` — Unique identifier for a Page
@@ -945,7 +1005,7 @@ client.collections.fields.create(
-**type:** `FieldCreateType` — Choose these appropriate field type for your collection data +**id:** `str` — Unique identifier for the Page
@@ -953,7 +1013,7 @@ client.collections.fields.create(
-**display_name:** `str` — The name of a field +**locale_id:** `typing.Optional[str]` — Unique identifier for a specific locale. Applicable, when using localization.
@@ -961,7 +1021,7 @@ client.collections.fields.create(
-**is_required:** `typing.Optional[bool]` — define whether a field is required in a collection +**site_id:** `typing.Optional[str]` — Unique identifier for the Site
@@ -969,7 +1029,7 @@ client.collections.fields.create(
-**help_text:** `typing.Optional[str]` — Additional text to help anyone filling out this field +**title:** `typing.Optional[str]` — Title of the Page
@@ -977,73 +1037,79 @@ client.collections.fields.create(
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. +**slug:** `typing.Optional[str]` — slug of the Page (derived from title)
-
-
+
+
+**parent_id:** `typing.Optional[str]` — Identifier of the parent folder +
-
-
client.collections.fields.update(...)
-#### 📝 Description +**collection_id:** `typing.Optional[str]` — Unique identifier for a linked Collection, value will be null if the Page is not part of a Collection. + +
+
+**created_on:** `typing.Optional[dt.datetime]` — The date the Page was created + +
+
+
-Update a custom field in a collection.

Required scope | `cms:write` -
-
+**last_updated:** `typing.Optional[dt.datetime]` — The date the Page was most recently updated + -#### 🔌 Usage -
+**archived:** `typing.Optional[bool]` — Whether the Page has been archived + +
+
+
-```python -from webflow.client import Webflow - -client = Webflow( - access_token="YOUR_ACCESS_TOKEN", -) -client.collections.fields.update( - collection_id="collection_id", - field_id="field_id", - is_required=False, - display_name="Post Body", - help_text="Add the body of your post here", -) - -``` +**draft:** `typing.Optional[bool]` — Whether the Page is a draft +
+ +
+
+ +**can_branch:** `typing.Optional[bool]` — Indicates whether the Page supports [Page Branching](https://university.webflow.com/lesson/page-branching) +
-#### ⚙️ Parameters -
+**is_branch:** `typing.Optional[bool]` — Indicates whether the Page is a Branch of another Page [Page Branching](https://university.webflow.com/lesson/page-branching) + +
+
+
-**collection_id:** `str` — Unique identifier for a Collection +**is_members_only:** `typing.Optional[bool]` — Indicates whether the Page is restricted by [Memberships Controls](https://university.webflow.com/lesson/webflow-memberships-overview#how-to-manage-page-restrictions)
@@ -1051,7 +1117,7 @@ client.collections.fields.update(
-**field_id:** `str` — Unique identifier for a Field in a collection +**seo:** `typing.Optional[PageSeo]` — SEO-related fields for the Page
@@ -1059,7 +1125,7 @@ client.collections.fields.update(
-**is_required:** `typing.Optional[bool]` — Define whether a field is required in a collection +**open_graph:** `typing.Optional[PageOpenGraph]` — Open Graph fields for the Page
@@ -1067,7 +1133,7 @@ client.collections.fields.update(
-**display_name:** `typing.Optional[str]` — The name of a field +**page_locale_id:** `typing.Optional[str]` — Unique ID of the page locale
@@ -1075,7 +1141,7 @@ client.collections.fields.update(
-**help_text:** `typing.Optional[str]` — Additional text to help anyone filling out this field +**published_path:** `typing.Optional[str]` — Relative path of the published page URL
@@ -1095,8 +1161,7 @@ client.collections.fields.update(
-## Collections Items -
client.collections.items.list_items(...) +
client.pages.get_content(...)
@@ -1108,7 +1173,11 @@ client.collections.fields.update(
-List of all Items within a Collection.

Required scope | `CMS:read` +Get static content from a static page. + +If you do not provide a Locale ID in your request, the response will return any content that can be localized from the Primary locale. + +Required scope | `pages:read`
@@ -1128,8 +1197,9 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.collections.items.list_items( - collection_id="collection_id", +client.pages.get_content( + page_id="63c720f9347c2139b248e552", + locale_id="65427cf400e02b306eaa04a0", ) ``` @@ -1146,15 +1216,7 @@ client.collections.items.list_items(
-**collection_id:** `str` — Unique identifier for a Collection - -
-
- -
-
- -**cms_locale_id:** `typing.Optional[str]` — Unique identifier for a CMS Locale. This UID is different from the Site locale identifier and is listed as `cmsLocaleId` in the Sites response. To query multiple locales, input a comma separated string. +**page_id:** `str` — Unique identifier for a Page
@@ -1162,7 +1224,7 @@ client.collections.items.list_items(
-**offset:** `typing.Optional[float]` — Offset used for pagination if the results have more than limit records +**locale_id:** `typing.Optional[str]` — Unique identifier for a specific locale. Applicable, when using localization.
@@ -1178,31 +1240,7 @@ client.collections.items.list_items(
-**name:** `typing.Optional[str]` — The name of the item(s) - -
-
- -
-
- -**slug:** `typing.Optional[str]` — The slug of the item - -
-
- -
-
- -**sort_by:** `typing.Optional[ItemsListItemsRequestSortBy]` — Sort results by the provided value - -
-
- -
-
- -**sort_order:** `typing.Optional[ItemsListItemsRequestSortOrder]` — Sorts the results by asc or desc +**offset:** `typing.Optional[float]` — Offset used for pagination if the results have more than limit records
@@ -1222,7 +1260,7 @@ client.collections.items.list_items(
-
client.collections.items.create_item(...) +
client.pages.update_static_content(...)
@@ -1234,7 +1272,11 @@ client.collections.items.list_items(
-Create Item in a Collection.

To create items across multiple locales, please use this endpoint.

Required scope | `CMS:write` +This endpoint allows for updating static content on a static page within a secondary locale. It is designed specifically for localized pages and can handle up to 1000 nodes per request. + +

Note:This endpoint is specifically for localized pages. Ensure that the locale specified is a valid secondary locale for the site.

+ +Required scope | `pages:write`
@@ -1249,25 +1291,29 @@ Create Item in a Collection.

To create items across multiple locales,
```python -from webflow import CollectionItemFieldData +from webflow import DomWriteNodesItem from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.collections.items.create_item( - collection_id="collection_id", - id="42b720ef280c7a7a3be8cabe", - cms_locale_id="653ad57de882f528b32e810e", - last_published="2022-11-29T16:22:43.159Z", - last_updated="2022-11-17T17:19:43.282Z", - created_on="2022-11-17T17:11:57.148Z", - is_archived=False, - is_draft=False, - field_data=CollectionItemFieldData( - name="Pan Galactic Gargle Blaster Recipe", - slug="pan-galactic-gargle-blaster", - ), +client.pages.update_static_content( + page_id="63c720f9347c2139b248e552", + locale_id="65427cf400e02b306eaa04a0", + nodes=[ + DomWriteNodesItem( + node_id="a245c12d-995b-55ee-5ec7-aa36a6cad623", + text="

The Hitchhiker’s Guide to the Galaxy

", + ), + DomWriteNodesItem( + node_id="a245c12d-995b-55ee-5ec7-aa36a6cad627", + text="

Don’t Panic!

Always know where your towel is.

", + ), + DomWriteNodesItem( + node_id="a245c12d-995b-55ee-5ec7-aa36a6cad629", + text='Marvin, the Paranoid Android', + ), + ], ) ``` @@ -1284,7 +1330,7 @@ client.collections.items.create_item(
-**collection_id:** `str` — Unique identifier for a Collection +**page_id:** `str` — Unique identifier for a Page
@@ -1292,7 +1338,7 @@ client.collections.items.create_item(
-**id:** `str` — Unique identifier for the Item +**nodes:** `typing.Sequence[DomWriteNodesItem]`
@@ -1300,7 +1346,7 @@ client.collections.items.create_item(
-**cms_locale_id:** `typing.Optional[str]` — Identifier for the locale of the CMS item +**locale_id:** `typing.Optional[str]` — Unique identifier for a specific locale. Applicable, when using localization.
@@ -1308,47 +1354,79 @@ client.collections.items.create_item(
-**last_published:** `typing.Optional[str]` — The date the item was last published +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+
+
-
-
-**last_updated:** `typing.Optional[str]` — The date the item was last updated -
+
+## Scripts +
client.scripts.list(...)
-**created_on:** `typing.Optional[str]` — The date the item was created - -
-
+#### 📝 Description
-**is_archived:** `typing.Optional[bool]` — Boolean determining if the Item is set to archived - +
+
+ +List of scripts registered to a Site. + +In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered +to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate +`custom_code` endpoints. +Additionally, Scripts can be remotely hosted, or registered as inline snippets. + +
Access to this endpoint requires a bearer token from a Data Client App.
+ +Required scope | `custom_code:read` +
+
+#### 🔌 Usage +
-**is_draft:** `typing.Optional[bool]` — Boolean determining if the Item is set to draft - +
+
+ +```python +from webflow.client import Webflow + +client = Webflow( + access_token="YOUR_ACCESS_TOKEN", +) +client.scripts.list( + site_id="580e63e98c9a982ac9b8b741", +) + +```
+
+
+ +#### ⚙️ Parameters
-**field_data:** `typing.Optional[CollectionItemFieldData]` +
+
+ +**site_id:** `str` — Unique identifier for a Site
@@ -1368,7 +1446,7 @@ client.collections.items.create_item(
-
client.collections.items.list_items_live(...) +
client.scripts.register_hosted(...)
@@ -1380,7 +1458,16 @@ client.collections.items.create_item(
-List of all live Items within a Collection.

Required scope | `CMS:read` +Add a script to a Site's Custom Code registry. + +In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered +to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate +`custom_code` endpoints. +Additionally, Scripts can be remotely hosted, or registered as inline snippets. + +
Access to this endpoint requires a bearer token from a Data Client App.
+ +Required scope | `custom_code:write`
@@ -1400,8 +1487,12 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.collections.items.list_items_live( - collection_id="collection_id", +client.scripts.register_hosted( + site_id="580e63e98c9a982ac9b8b741", + hosted_location="hostedLocation", + integrity_hash="integrityHash", + version="version", + display_name="displayName", ) ``` @@ -1418,23 +1509,7 @@ client.collections.items.list_items_live(
-**collection_id:** `str` — Unique identifier for a Collection - -
-
- -
-
- -**cms_locale_id:** `typing.Optional[str]` — Unique identifier for a CMS Locale. This UID is different from the Site locale identifier and is listed as `cmsLocaleId` in the Sites response. To query multiple locales, input a comma separated string. - -
-
- -
-
- -**offset:** `typing.Optional[float]` — Offset used for pagination if the results have more than limit records +**site_id:** `str` — Unique identifier for a Site
@@ -1442,7 +1517,7 @@ client.collections.items.list_items_live(
-**limit:** `typing.Optional[float]` — Maximum number of records to be returned (max limit: 100) +**hosted_location:** `str` — URI for an externally hosted script location
@@ -1450,7 +1525,7 @@ client.collections.items.list_items_live(
-**name:** `typing.Optional[str]` — The name of the item(s) +**integrity_hash:** `str` — Sub-Resource Integrity Hash
@@ -1458,7 +1533,7 @@ client.collections.items.list_items_live(
-**slug:** `typing.Optional[str]` — The slug of the item +**version:** `str` — A Semantic Version (SemVer) string, denoting the version of the script
@@ -1466,7 +1541,7 @@ client.collections.items.list_items_live(
-**sort_by:** `typing.Optional[ItemsListItemsLiveRequestSortBy]` — Sort results by the provided value +**display_name:** `str` — User-facing name for the script. Must be between 1 and 50 alphanumeric characters
@@ -1474,7 +1549,7 @@ client.collections.items.list_items_live(
-**sort_order:** `typing.Optional[ItemsListItemsLiveRequestSortOrder]` — Sorts the results by asc or desc +**can_copy:** `typing.Optional[bool]` — Define whether the script can be copied on site duplication and transfer
@@ -1494,7 +1569,7 @@ client.collections.items.list_items_live(
-
client.collections.items.create_item_live(...) +
client.scripts.register_inline(...)
@@ -1506,7 +1581,15 @@ client.collections.items.list_items_live(
-Create live Item in a Collection. This Item will be published to the live site.

To create items across multiple locales, please use this endpoint.

Required scope | `CMS:write` +Add a script to a Site's Custom Code registry. Inline scripts can be between 1 and 2000 characters. + +In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered +to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate +`custom_code` endpoints. + +
Access to this endpoint requires a bearer token from a Data Client App.
+ +Required scope | `custom_code:write`
@@ -1521,25 +1604,16 @@ Create live Item in a Collection. This Item will be published to the live site.
```python -from webflow import CollectionItemFieldData from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.collections.items.create_item_live( - collection_id="collection_id", - id="42b720ef280c7a7a3be8cabe", - cms_locale_id="653ad57de882f528b32e810e", - last_published="2022-11-29T16:22:43.159Z", - last_updated="2022-11-17T17:19:43.282Z", - created_on="2022-11-17T17:11:57.148Z", - is_archived=False, - is_draft=False, - field_data=CollectionItemFieldData( - name="Pan Galactic Gargle Blaster Recipe", - slug="pan-galactic-gargle-blaster", - ), +client.scripts.register_inline( + site_id="580e63e98c9a982ac9b8b741", + source_code="alert('hello world');", + version="0.0.1", + display_name="Alert", ) ``` @@ -1556,7 +1630,7 @@ client.collections.items.create_item_live(
-**collection_id:** `str` — Unique identifier for a Collection +**site_id:** `str` — Unique identifier for a Site
@@ -1564,7 +1638,7 @@ client.collections.items.create_item_live(
-**id:** `str` — Unique identifier for the Item +**source_code:** `str` — The code to be added to the site (to be hosted by Webflow).
@@ -1572,7 +1646,7 @@ client.collections.items.create_item_live(
-**cms_locale_id:** `typing.Optional[str]` — Identifier for the locale of the CMS item +**version:** `str` — A Semantic Version (SemVer) string, denoting the version of the script
@@ -1580,7 +1654,7 @@ client.collections.items.create_item_live(
-**last_published:** `typing.Optional[str]` — The date the item was last published +**display_name:** `str` — User-facing name for the script. Must be between 1 and 50 alphanumeric characters
@@ -1588,7 +1662,7 @@ client.collections.items.create_item_live(
-**last_updated:** `typing.Optional[str]` — The date the item was last updated +**integrity_hash:** `typing.Optional[str]` — Sub-Resource Integrity Hash. Only required for externally hosted scripts (passed via hostedLocation)
@@ -1596,7 +1670,7 @@ client.collections.items.create_item_live(
-**created_on:** `typing.Optional[str]` — The date the item was created +**can_copy:** `typing.Optional[bool]` — Define whether the script can be copied on site duplication and transfer
@@ -1604,23 +1678,72 @@ client.collections.items.create_item_live(
-**is_archived:** `typing.Optional[bool]` — Boolean determining if the Item is set to archived +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+
+
+ + + + +
+ +## Assets +
client.assets.list(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List assets for a given site + +Required scope | `assets:read` +
+
+
+
+ +#### 🔌 Usage
-**is_draft:** `typing.Optional[bool]` — Boolean determining if the Item is set to draft - +
+
+ +```python +from webflow.client import Webflow + +client = Webflow( + access_token="YOUR_ACCESS_TOKEN", +) +client.assets.list( + site_id="580e63e98c9a982ac9b8b741", +) + +``` +
+
+#### ⚙️ Parameters + +
+
+
-**field_data:** `typing.Optional[CollectionItemFieldData]` +**site_id:** `str` — Unique identifier for a Site
@@ -1640,7 +1763,7 @@ client.collections.items.create_item_live(
-
client.collections.items.create_item_for_multiple_locales(...) +
client.assets.create(...)
@@ -1652,7 +1775,13 @@ client.collections.items.create_item_live(
-Create single Item in a Collection with multiple corresponding locales.

Required scope | `CMS:write` +Create a new asset entry. + +This endpoint generates a response with the following information: `uploadUrl` and `uploadDetails`. +You can use these two properties to [upload the file to Amazon s3 by making a POST](https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPOST.html) +request to the `uploadUrl` with the `uploadDetails` object as your header information in the request. + +Required scope | `assets:write`
@@ -1672,9 +1801,10 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.collections.items.create_item_for_multiple_locales( - collection_id="collection_id", - id="580e64008c9a982ac9b8b754", +client.assets.create( + site_id="580e63e98c9a982ac9b8b741", + file_name="file.png", + file_hash="3c7d87c9575702bc3b1e991f4d3c638e", ) ``` @@ -1691,7 +1821,7 @@ client.collections.items.create_item_for_multiple_locales(
-**collection_id:** `str` — Unique identifier for a Collection +**site_id:** `str` — Unique identifier for a Site
@@ -1699,7 +1829,7 @@ client.collections.items.create_item_for_multiple_locales(
-**id:** `str` — Unique identifier for the Item +**file_name:** `str` — File name including file extension. File names must be less than 100 characters.
@@ -1707,7 +1837,7 @@ client.collections.items.create_item_for_multiple_locales(
-**cms_locale_ids:** `typing.Optional[typing.Sequence[str]]` — Array of identifiers for the locales where the item will be created +**file_hash:** `str` — MD5 hash of the file
@@ -1715,7 +1845,7 @@ client.collections.items.create_item_for_multiple_locales(
-**last_published:** `typing.Optional[str]` — The date the item was last published +**parent_folder:** `typing.Optional[str]` — ID of the Asset folder (optional)
@@ -1723,39 +1853,71 @@ client.collections.items.create_item_for_multiple_locales(
-**last_updated:** `typing.Optional[str]` — The date the item was last updated +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+ +
-
-
-**created_on:** `typing.Optional[str]` — The date the item was created -
+
+
client.assets.get(...)
-**is_archived:** `typing.Optional[bool]` — Boolean determining if the Item is set to archived - +#### 📝 Description + +
+
+ +
+
+ +Get an Asset + +Required scope | `assets:read` +
+
+#### 🔌 Usage +
-**is_draft:** `typing.Optional[bool]` — Boolean determining if the Item is set to draft - +
+
+ +```python +from webflow.client import Webflow + +client = Webflow( + access_token="YOUR_ACCESS_TOKEN", +) +client.assets.get( + asset_id="580e63fc8c9a982ac9b8b745", +) + +``` +
+
+#### ⚙️ Parameters + +
+
+
-**field_data:** `typing.Optional[BulkCollectionItemFieldData]` +**asset_id:** `str` — Unique identifier for an Asset on a site
@@ -1775,7 +1937,7 @@ client.collections.items.create_item_for_multiple_locales(
-
client.collections.items.get_item(...) +
client.assets.delete(...)
@@ -1787,7 +1949,9 @@ client.collections.items.create_item_for_multiple_locales(
-Get details of a selected Collection Item.

Required scope | `CMS:read` +Delete an Asset + +Required Scope: `assets: write`
@@ -1807,9 +1971,8 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.collections.items.get_item( - collection_id="collection_id", - item_id="item_id", +client.assets.delete( + asset_id="580e63fc8c9a982ac9b8b745", ) ``` @@ -1826,23 +1989,7 @@ client.collections.items.get_item(
-**collection_id:** `str` — Unique identifier for a Collection - -
-
- -
-
- -**item_id:** `str` — Unique identifier for an Item - -
-
- -
-
- -**cms_locale_id:** `typing.Optional[str]` — Unique identifier for a CMS Locale. This UID is different from the Site locale identifier and is listed as `cmsLocaleId` in the Sites response. To query multiple locales, input a comma separated string. +**asset_id:** `str` — Unique identifier for an Asset on a site
@@ -1862,7 +2009,7 @@ client.collections.items.get_item(
-
client.collections.items.delete_item(...) +
client.assets.update(...)
@@ -1874,7 +2021,9 @@ client.collections.items.get_item(
-Delete an Item from a Collection. This endpoint does not currently support bulk deletion.

Required scope | `CMS:write` +Update an Asset + +Required scope | `assets:write`
@@ -1894,9 +2043,8 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.collections.items.delete_item( - collection_id="collection_id", - item_id="item_id", +client.assets.update( + asset_id="580e63fc8c9a982ac9b8b745", ) ``` @@ -1913,7 +2061,7 @@ client.collections.items.delete_item(
-**collection_id:** `str` — Unique identifier for a Collection +**asset_id:** `str` — Unique identifier for an Asset on a site
@@ -1921,7 +2069,7 @@ client.collections.items.delete_item(
-**item_id:** `str` — Unique identifier for an Item +**locale_id:** `typing.Optional[str]` — Unique identifier for a specific locale. Applicable, when using localization.
@@ -1929,7 +2077,7 @@ client.collections.items.delete_item(
-**cms_locale_id:** `typing.Optional[str]` — Unique identifier for a CMS Locale. This UID is different from the Site locale identifier and is listed as `cmsLocaleId` in the Sites response. To query multiple locales, input a comma separated string. +**display_name:** `typing.Optional[str]` — A human readable name for the asset
@@ -1949,7 +2097,7 @@ client.collections.items.delete_item(
-
client.collections.items.update_item(...) +
client.assets.list_folders(...)
@@ -1961,7 +2109,9 @@ client.collections.items.delete_item(
-Update a selected Item in a Collection.

Required scope | `CMS:write` +List Asset Folders within a given site + +Required scope | `assets:read`
@@ -1976,26 +2126,13 @@ Update a selected Item in a Collection.

Required scope | `CMS:write`
```python -from webflow import CollectionItemFieldData from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.collections.items.update_item( - collection_id="collection_id", - item_id="item_id", - id="42b720ef280c7a7a3be8cabe", - cms_locale_id="653ad57de882f528b32e810e", - last_published="2022-11-29T16:22:43.159Z", - last_updated="2022-11-17T17:19:43.282Z", - created_on="2022-11-17T17:11:57.148Z", - is_archived=False, - is_draft=False, - field_data=CollectionItemFieldData( - name="Pan Galactic Gargle Blaster Recipe", - slug="pan-galactic-gargle-blaster", - ), +client.assets.list_folders( + site_id="580e63e98c9a982ac9b8b741", ) ``` @@ -2012,7 +2149,7 @@ client.collections.items.update_item(
-**collection_id:** `str` — Unique identifier for a Collection +**site_id:** `str` — Unique identifier for a Site
@@ -2020,55 +2157,72 @@ client.collections.items.update_item(
-**item_id:** `str` — Unique identifier for an Item +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+
+
-
-
-**id:** `str` — Unique identifier for the Item -
+
+
client.assets.create_folder(...)
-**cms_locale_id:** `typing.Optional[str]` — Identifier for the locale of the CMS item - -
-
+#### 📝 Description
-**last_published:** `typing.Optional[str]` — The date the item was last published - -
-
-
-**last_updated:** `typing.Optional[str]` — The date the item was last updated - +Create an Asset Folder within a given site + +Required scope | `assets:write`
+ + + +#### 🔌 Usage
-**created_on:** `typing.Optional[str]` — The date the item was created - +
+
+ +```python +from webflow.client import Webflow + +client = Webflow( + access_token="YOUR_ACCESS_TOKEN", +) +client.assets.create_folder( + site_id="580e63e98c9a982ac9b8b741", + display_name="my asset folder", +) + +```
+
+
+ +#### ⚙️ Parameters
-**is_archived:** `typing.Optional[bool]` — Boolean determining if the Item is set to archived +
+
+ +**site_id:** `str` — Unique identifier for a Site
@@ -2076,7 +2230,7 @@ client.collections.items.update_item(
-**is_draft:** `typing.Optional[bool]` — Boolean determining if the Item is set to draft +**display_name:** `str` — A human readable name for the Asset Folder
@@ -2084,7 +2238,7 @@ client.collections.items.update_item(
-**field_data:** `typing.Optional[CollectionItemFieldData]` +**parent_folder:** `typing.Optional[str]` — An (optional) pointer to a parent Asset Folder (or null for root)
@@ -2104,7 +2258,7 @@ client.collections.items.update_item(
-
client.collections.items.get_item_live(...) +
client.assets.get_folder(...)
@@ -2116,7 +2270,9 @@ client.collections.items.update_item(
-Get details of a selected Collection live Item.

Required scope | `CMS:read` +Get details about a specific Asset Folder + +Required scope | `assets:read`
@@ -2136,9 +2292,8 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.collections.items.get_item_live( - collection_id="collection_id", - item_id="item_id", +client.assets.get_folder( + asset_folder_id="6390c49774a71f0e3c1a08ee", ) ``` @@ -2155,23 +2310,7 @@ client.collections.items.get_item_live(
-**collection_id:** `str` — Unique identifier for a Collection - -
-
- -
-
- -**item_id:** `str` — Unique identifier for an Item - -
-
- -
-
- -**cms_locale_id:** `typing.Optional[str]` — Unique identifier for a CMS Locale. This UID is different from the Site locale identifier and is listed as `cmsLocaleId` in the Sites response. To query multiple locales, input a comma separated string. +**asset_folder_id:** `str` — Unique identifier for an Asset Folder
@@ -2191,7 +2330,8 @@ client.collections.items.get_item_live(
-
client.collections.items.delete_item_live(...) +## Webhooks +
client.webhooks.list(...)
@@ -2203,7 +2343,9 @@ client.collections.items.get_item_live(
-Remove a live item from the site. Removing a published item will unpublish the item from the live site and set it to draft. This endpoint does not currently support bulk deletion.

Required scope | `CMS:write` +List all App-created Webhooks registered for a given site + +Required scope | `sites:read`
@@ -2223,9 +2365,8 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.collections.items.delete_item_live( - collection_id="collection_id", - item_id="item_id", +client.webhooks.list( + site_id="580e63e98c9a982ac9b8b741", ) ``` @@ -2242,23 +2383,7 @@ client.collections.items.delete_item_live(
-**collection_id:** `str` — Unique identifier for a Collection - -
-
- -
-
- -**item_id:** `str` — Unique identifier for an Item - -
-
- -
-
- -**cms_locale_id:** `typing.Optional[str]` — Unique identifier for a CMS Locale. This UID is different from the Site locale identifier and is listed as `cmsLocaleId` in the Sites response. To query multiple locales, input a comma separated string. +**site_id:** `str` — Unique identifier for a Site
@@ -2278,7 +2403,7 @@ client.collections.items.delete_item_live(
-
client.collections.items.update_item_live(...) +
client.webhooks.create(...)
@@ -2290,7 +2415,12 @@ client.collections.items.delete_item_live(
-Update a selected live Item in a Collection. The updates for this Item will be published to the live site.

Required scope | `CMS:write` +Create a new Webhook. + +Limit of 75 registrations per `triggerType`, per site. + +
Access to this endpoint requires a bearer token from a Data Client App.
+Required scope | `sites:write`
@@ -2305,25 +2435,26 @@ Update a selected live Item in a Collection. The updates for this Item will be p
```python -from webflow import CollectionItemFieldData +import datetime + +from webflow import TriggerType from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.collections.items.update_item_live( - collection_id="collection_id", - item_id="item_id", - id="42b720ef280c7a7a3be8cabe", - cms_locale_id="653ad57de882f528b32e810e", - last_published="2022-11-29T16:22:43.159Z", - last_updated="2022-11-17T17:19:43.282Z", - created_on="2022-11-17T17:11:57.148Z", - is_archived=False, - is_draft=False, - field_data=CollectionItemFieldData( - name="Pan Galactic Gargle Blaster Recipe", - slug="pan-galactic-gargle-blaster", +client.webhooks.create( + site_id_="580e63e98c9a982ac9b8b741", + id="582266e0cd48de0f0e3c6d8b", + trigger_type=TriggerType.FORM_SUBMISSION, + url="https://webhook.site/7f7f7f7f-7f7f-7f7f-7f7f-7f7f7f7f7f7f", + workspace_id="4f4e46fd476ea8c507000001", + site_id="562ac0395358780a1f5e6fbd", + last_triggered=datetime.datetime.fromisoformat( + "2023-02-08 23:59:28+00:00", + ), + created_on=datetime.datetime.fromisoformat( + "2022-11-08 23:59:28+00:00", ), ) @@ -2341,15 +2472,7 @@ client.collections.items.update_item_live(
-**collection_id:** `str` — Unique identifier for a Collection - -
-
- -
-
- -**item_id:** `str` — Unique identifier for an Item +**site_id_:** `str` — Unique identifier for a Site
@@ -2357,7 +2480,7 @@ client.collections.items.update_item_live(
-**id:** `str` — Unique identifier for the Item +**id:** `typing.Optional[str]` — Unique identifier for the Webhook registration
@@ -2365,7 +2488,7 @@ client.collections.items.update_item_live(
-**cms_locale_id:** `typing.Optional[str]` — Identifier for the locale of the CMS item +**trigger_type:** `typing.Optional[TriggerType]`
@@ -2373,7 +2496,7 @@ client.collections.items.update_item_live(
-**last_published:** `typing.Optional[str]` — The date the item was last published +**url:** `typing.Optional[str]` — URL to send the Webhook payload to
@@ -2381,7 +2504,7 @@ client.collections.items.update_item_live(
-**last_updated:** `typing.Optional[str]` — The date the item was last updated +**workspace_id:** `typing.Optional[str]` — Unique identifier for the Workspace the Webhook is registered in
@@ -2389,7 +2512,7 @@ client.collections.items.update_item_live(
-**created_on:** `typing.Optional[str]` — The date the item was created +**site_id:** `typing.Optional[str]` — Unique identifier for the Site the Webhook is registered in
@@ -2397,7 +2520,7 @@ client.collections.items.update_item_live(
-**is_archived:** `typing.Optional[bool]` — Boolean determining if the Item is set to archived +**filter:** `typing.Optional[WebhookFilter]` — Only supported for the `form_submission` trigger type. Filter for the form you want Webhooks to be sent for.
@@ -2405,7 +2528,7 @@ client.collections.items.update_item_live(
-**is_draft:** `typing.Optional[bool]` — Boolean determining if the Item is set to draft +**last_triggered:** `typing.Optional[dt.datetime]` — Date the Webhook instance was last triggered
@@ -2413,7 +2536,7 @@ client.collections.items.update_item_live(
-**field_data:** `typing.Optional[CollectionItemFieldData]` +**created_on:** `typing.Optional[dt.datetime]` — Date the Webhook registration was created
@@ -2433,7 +2556,7 @@ client.collections.items.update_item_live(
-
client.collections.items.publish_item(...) +
client.webhooks.get(...)
@@ -2445,7 +2568,9 @@ client.collections.items.update_item_live(
-Publish an item or multiple items.

Required scope | `cms:write` +Get a specific Webhook instance + +Required scope: `sites:read`
@@ -2465,9 +2590,8 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.collections.items.publish_item( - collection_id="collection_id", - item_ids=["itemIds"], +client.webhooks.get( + webhook_id="580e64008c9a982ac9b8b754", ) ``` @@ -2484,15 +2608,7 @@ client.collections.items.publish_item(
-**collection_id:** `str` — Unique identifier for a Collection - -
-
- -
-
- -**item_ids:** `typing.Sequence[str]` +**webhook_id:** `str` — Unique identifier for a Webhook
@@ -2512,8 +2628,7 @@ client.collections.items.publish_item(
-## Pages -
client.pages.list(...) +
client.webhooks.delete(...)
@@ -2525,7 +2640,9 @@ client.collections.items.publish_item(
-List of all pages for a site

Required scope | `pages:read` +Remove a Webhook + +Required scope: `sites:read`
@@ -2545,8 +2662,8 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.pages.list( - site_id="site_id", +client.webhooks.delete( + webhook_id="580e64008c9a982ac9b8b754", ) ``` @@ -2563,7 +2680,7 @@ client.pages.list(
-**site_id:** `str` — Unique identifier for a Site +**webhook_id:** `str` — Unique identifier for a Webhook
@@ -2571,55 +2688,34 @@ client.pages.list(
-**locale:** `typing.Optional[str]` — Unique identifier for a specific locale. Applicable, when using localization. +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+ +
-
-
-**limit:** `typing.Optional[float]` — Maximum number of records to be returned (max limit: 100) -
+
+## Forms +
client.forms.list(...)
-**offset:** `typing.Optional[float]` — Offset used for pagination if the results have more than limit records - -
-
+#### 📝 Description
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. - -
-
- - - - - - -
- -
client.pages.get_metadata(...) -
-
- -#### 📝 Description -
-
-
+List forms for a given site. -Get metadata information for a single page

Required scope | `pages:read` +Required scope | `forms:read`
@@ -2639,8 +2735,8 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.pages.get_metadata( - page_id="page_id", +client.forms.list( + site_id="580e63e98c9a982ac9b8b741", ) ``` @@ -2657,7 +2753,15 @@ client.pages.get_metadata(
-**page_id:** `str` — Unique identifier for a Page +**site_id:** `str` — Unique identifier for a Site + +
+
+ +
+
+ +**limit:** `typing.Optional[float]` — Maximum number of records to be returned (max limit: 100)
@@ -2665,7 +2769,7 @@ client.pages.get_metadata(
-**locale:** `typing.Optional[str]` — Unique identifier for a specific locale. Applicable, when using localization. +**offset:** `typing.Optional[float]` — Offset used for pagination if the results have more than limit records
@@ -2685,7 +2789,7 @@ client.pages.get_metadata(
-
client.pages.update_page_settings(...) +
client.forms.get(...)
@@ -2697,7 +2801,9 @@ client.pages.get_metadata(
-Update Page-level metadata, including SEO and Open Graph fields.

Required scope | `pages:write` +Get information about a given form. + +Required scope | `forms:read`
@@ -2712,41 +2818,13 @@ Update Page-level metadata, including SEO and Open Graph fields.

Requ
```python -import datetime - -from webflow import PageOpenGraph, PageSeo from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.pages.update_page_settings( - page_id="page_id", - id="6596da6045e56dee495bcbba", - site_id="6258612d1ee792848f805dcf", - title="Guide to the Galaxy", - slug="guide-to-the-galaxy", - parent_id="6419db964a9c435aa3af6251", - collection_id="6390c49774a71f12831a08e3", - created_on=datetime.datetime.fromisoformat( - "2024-03-11 10:42:00+00:00", - ), - last_updated=datetime.datetime.fromisoformat( - "2024-03-11 10:42:42+00:00", - ), - archived=False, - draft=False, - can_branch=True, - seo=PageSeo( - title="The Ultimate Hitchhiker's Guide to the Galaxy", - description="Everything you need to know about the galaxy, from avoiding Vogon poetry to the importance of towels.", - ), - open_graph=PageOpenGraph( - title="Explore the Cosmos with The Ultimate Guide", - title_copied=False, - description="Dive deep into the mysteries of the universe with your guide to everything galactic.", - description_copied=False, - ), +client.forms.get( + form_id="580e63e98c9a982ac9b8b741", ) ``` @@ -2763,7 +2841,7 @@ client.pages.update_page_settings(
-**page_id:** `str` — Unique identifier for a Page +**form_id:** `str` — Unique identifier for a Form
@@ -2771,55 +2849,71 @@ client.pages.update_page_settings(
-**locale:** `typing.Optional[str]` — Unique identifier for a specific locale. Applicable, when using localization. +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+
+
-
-
-**id:** `typing.Optional[str]` — Unique identifier for the Page -
+
+
client.forms.list_submissions(...)
-**site_id:** `typing.Optional[str]` — Unique identifier for the Site - -
-
+#### 📝 Description
-**title:** `typing.Optional[str]` — Title of the Page - -
-
-
-**slug:** `typing.Optional[str]` — slug of the Page (derived from title) - +List form submissions for a given form + +Required scope | `forms:read` +
+
+#### 🔌 Usage +
-**parent_id:** `typing.Optional[str]` — Identifier of the parent folder - +
+
+ +```python +from webflow.client import Webflow + +client = Webflow( + access_token="YOUR_ACCESS_TOKEN", +) +client.forms.list_submissions( + form_id="580e63e98c9a982ac9b8b741", +) + +```
+
+
+ +#### ⚙️ Parameters
-**collection_id:** `typing.Optional[str]` — Unique identifier for a linked Collection, value will be null if the Page is not part of a Collection. +
+
+ +**form_id:** `str` — Unique identifier for a Form
@@ -2827,7 +2921,7 @@ client.pages.update_page_settings(
-**created_on:** `typing.Optional[dt.datetime]` — The date the Page was created +**offset:** `typing.Optional[float]` — Offset used for pagination if the results have more than limit records
@@ -2835,7 +2929,7 @@ client.pages.update_page_settings(
-**last_updated:** `typing.Optional[dt.datetime]` — The date the Page was most recently updated +**limit:** `typing.Optional[float]` — Maximum number of records to be returned (max limit: 100)
@@ -2843,47 +2937,71 @@ client.pages.update_page_settings(
-**archived:** `typing.Optional[bool]` — Whether the Page has been archived +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+
+
-
-
-**draft:** `typing.Optional[bool]` — Whether the Page is a draft -
+
+
client.forms.get_submission(...)
-**can_branch:** `typing.Optional[bool]` — Indicates whether the Page supports [Page Branching](https://university.webflow.com/lesson/page-branching) - -
-
+#### 📝 Description
-**is_members_only:** `typing.Optional[bool]` — Indicates whether the Page is restricted by [Memberships Controls](https://university.webflow.com/lesson/webflow-memberships-overview#how-to-manage-page-restrictions) - +
+
+ +Get information about a given form submissio. + +Required scope | `forms:read` +
+
+#### 🔌 Usage +
-**seo:** `typing.Optional[PageSeo]` — SEO-related fields for the Page - +
+
+ +```python +from webflow.client import Webflow + +client = Webflow( + access_token="YOUR_ACCESS_TOKEN", +) +client.forms.get_submission( + form_submission_id="580e63e98c9a982ac9b8b741", +) + +``` +
+
+#### ⚙️ Parameters +
-**open_graph:** `typing.Optional[PageOpenGraph]` — Open Graph fields for the Page +
+
+ +**form_submission_id:** `str` — Unique identifier for a Form Submission
@@ -2903,7 +3021,7 @@ client.pages.update_page_settings(
-
client.pages.get_content(...) +
client.forms.update_submission(...)
@@ -2915,7 +3033,9 @@ client.pages.update_page_settings(
-Get static content from a static page.
If you do not provide a Locale ID in your request, the response will return any content that can be localized from the Primary locale

Required scope | `pages:read` +Update hidden fields on a form submission + +Required scope | `forms:write`
@@ -2935,8 +3055,8 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.pages.get_content( - page_id="page_id", +client.forms.update_submission( + form_submission_id="580e63e98c9a982ac9b8b741", ) ``` @@ -2953,23 +3073,7 @@ client.pages.get_content(
-**page_id:** `str` — Unique identifier for a Page - -
-
- -
-
- -**locale:** `typing.Optional[str]` — Unique identifier for a specific locale. Applicable, when using localization. - -
-
- -
-
- -**limit:** `typing.Optional[float]` — Maximum number of records to be returned (max limit: 100) +**form_submission_id:** `str` — Unique identifier for a Form Submission
@@ -2977,7 +3081,7 @@ client.pages.get_content(
-**offset:** `typing.Optional[float]` — Offset used for pagination if the results have more than limit records +**form_submission_data:** `typing.Optional[typing.Dict[str, typing.Any]]` — An existing **hidden field** defined on the form schema, and the corresponding value to set
@@ -2997,7 +3101,8 @@ client.pages.get_content(
-
client.pages.update_static_content(...) +## Users +
client.users.list(...)
@@ -3009,7 +3114,9 @@ client.pages.get_content(
-Update static content on a static page. This endpoint supports sending 1000 nodes per request.

Required scope | `pages:write` +Get a list of users for a site + +Required scope | `users:read`
@@ -3024,29 +3131,13 @@ Update static content on a static page. This endpoint supports sending 1000 node
```python -from webflow import DomWriteNodesItem from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.pages.update_static_content( - page_id="page_id", - locale="locale", - nodes=[ - DomWriteNodesItem( - node_id="a245c12d-995b-55ee-5ec7-aa36a6cad623", - text="

The Hitchhiker's Guide to the Galaxy

", - ), - DomWriteNodesItem( - node_id="a245c12d-995b-55ee-5ec7-aa36a6cad627", - text="

Don't Panic!

Always know where your towel is.

", - ), - DomWriteNodesItem( - node_id="a245c12d-995b-55ee-5ec7-aa36a6cad629", - text="Marvin, the Paranoid Android", - ), - ], +client.users.list( + site_id="580e63e98c9a982ac9b8b741", ) ``` @@ -3063,7 +3154,7 @@ client.pages.update_static_content(
-**page_id:** `str` — Unique identifier for a Page +**site_id:** `str` — Unique identifier for a Site
@@ -3071,7 +3162,7 @@ client.pages.update_static_content(
-**locale:** `str` — The locale identifier. +**offset:** `typing.Optional[float]` — Offset used for pagination if the results have more than limit records
@@ -3079,7 +3170,21 @@ client.pages.update_static_content(
-**nodes:** `typing.Sequence[DomWriteNodesItem]` +**limit:** `typing.Optional[float]` — Maximum number of records to be returned (max limit: 100) + +
+
+ +
+
+ +**sort:** `typing.Optional[UsersListRequestSort]` + +Sort string to use when ordering users + +Example(`CreatedOn`, `Email`, `Status`, `LastLogin`, `UpdatedOn`). + +Can be prefixed with a `-` to reverse the sort (ex. `-CreatedOn`)
@@ -3099,8 +3204,7 @@ client.pages.update_static_content(
-## Pages Scripts -
client.pages.scripts.get_custom_code(...) +
client.users.get(...)
@@ -3112,7 +3216,9 @@ client.pages.update_static_content(
-Get all registered scripts that have been applied to a specific Page.

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints.
Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:read` +Get a User by ID + +Required scope | `users:read`
@@ -3132,8 +3238,9 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.pages.scripts.get_custom_code( - page_id="page_id", +client.users.get( + site_id="580e63e98c9a982ac9b8b741", + user_id="580e63e98c9a982ac9b8b741", ) ``` @@ -3150,7 +3257,15 @@ client.pages.scripts.get_custom_code(
-**page_id:** `str` — Unique identifier for a Page +**site_id:** `str` — Unique identifier for a Site + +
+
+ +
+
+ +**user_id:** `str` — Unique identifier for a User
@@ -3170,7 +3285,7 @@ client.pages.scripts.get_custom_code(
-
client.pages.scripts.upsert_custom_code(...) +
client.users.delete(...)
@@ -3182,7 +3297,9 @@ client.pages.scripts.get_custom_code(
-Add a registered script to a Page.

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints.
Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:write` +Delete a User by ID + +Required scope | `users:write`
@@ -3197,27 +3314,14 @@ Add a registered script to a Page.

In order to use the Custom Code AP
```python -from webflow import ScriptApply, ScriptApplyLocation from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.pages.scripts.upsert_custom_code( - page_id="page_id", - scripts=[ - ScriptApply( - id="cms_slider", - location=ScriptApplyLocation.HEADER, - version="1.0.0", - attributes={"my-attribute": "some-value"}, - ), - ScriptApply( - id="alert", - location=ScriptApplyLocation.HEADER, - version="0.0.1", - ), - ], +client.users.delete( + site_id="580e63e98c9a982ac9b8b741", + user_id="580e63e98c9a982ac9b8b741", ) ``` @@ -3234,23 +3338,7 @@ client.pages.scripts.upsert_custom_code(
-**page_id:** `str` — Unique identifier for a Page - -
-
- -
-
- -**scripts:** `typing.Optional[typing.Sequence[ScriptApply]]` — A list of scripts applied to a Site or a Page - -
-
- -
-
- -**last_updated:** `typing.Optional[str]` — Date when the Site's scripts were last updated +**site_id:** `str` — Unique identifier for a Site
@@ -3258,7 +3346,7 @@ client.pages.scripts.upsert_custom_code(
-**created_on:** `typing.Optional[str]` — Date when the Site's scripts were created +**user_id:** `str` — Unique identifier for a User
@@ -3278,7 +3366,7 @@ client.pages.scripts.upsert_custom_code(
-
client.pages.scripts.delete_custom_code(...) +
client.users.update(...)
@@ -3290,7 +3378,12 @@ client.pages.scripts.upsert_custom_code(
-Delete the custom code block that an app has created for a page

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints.
Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:write` +Update a User by ID + +Required scope | `users:write` + +The email and password +fields cannot be updated using this endpoint
@@ -3304,31 +3397,64 @@ Delete the custom code block that an app has created for a page

In or
-```python -from webflow.client import Webflow - -client = Webflow( - access_token="YOUR_ACCESS_TOKEN", -) -client.pages.scripts.delete_custom_code( - page_id="page_id", -) - -``` -
-
+```python +from webflow import UsersUpdateRequestData +from webflow.client import Webflow + +client = Webflow( + access_token="YOUR_ACCESS_TOKEN", +) +client.users.update( + site_id="580e63e98c9a982ac9b8b741", + user_id="580e63e98c9a982ac9b8b741", + data=UsersUpdateRequestData( + name="Some One", + accept_privacy=False, + accept_communications=False, + ), + access_groups=["webflowers", "platinum", "free-tier"], +) + +``` + +
+ + + +#### ⚙️ Parameters + +
+
+ +
+
+ +**site_id:** `str` — Unique identifier for a Site + +
+
+ +
+
+ +**user_id:** `str` — Unique identifier for a User +
-#### ⚙️ Parameters -
+**data:** `typing.Optional[UsersUpdateRequestData]` + +
+
+
-**page_id:** `str` — Unique identifier for a Page +**access_groups:** `typing.Optional[typing.Sequence[str]]` — An array of access group slugs. Access groups are assigned to the user as type `admin` and the user remains in the group until removed. +
@@ -3348,8 +3474,7 @@ client.pages.scripts.delete_custom_code(
-## Sites Scripts -
client.sites.scripts.get_custom_code(...) +
client.users.invite(...)
@@ -3361,7 +3486,11 @@ client.pages.scripts.delete_custom_code(
-Get all registered scripts that have been applied to a specific Site.
Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:read` +Create and invite a user with an email address. + +The user will be sent and invite via email, which they will need to accept in order to join paid any paid access group. + +Required scope | `users:write`
@@ -3381,8 +3510,10 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.sites.scripts.get_custom_code( - site_id="site_id", +client.users.invite( + site_id="580e63e98c9a982ac9b8b741", + email="some.one@home.com", + access_groups=["webflowers"], ) ``` @@ -3401,6 +3532,23 @@ client.sites.scripts.get_custom_code( **site_id:** `str` — Unique identifier for a Site + +
+ +
+
+ +**email:** `str` — Email address of user to send invite to + +
+
+ +
+
+ +**access_groups:** `typing.Optional[typing.Sequence[str]]` — An array of access group slugs. Access groups are assigned to the user as type `admin` and the user remains in the group until removed. + +
@@ -3419,7 +3567,8 @@ client.sites.scripts.get_custom_code(
-
client.sites.scripts.upsert_custom_code(...) +## AccessGroups +
client.access_groups.list(...)
@@ -3431,7 +3580,9 @@ client.sites.scripts.get_custom_code(
-Add a registered script to a Site.

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints.
Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:write` +Get a list of access groups for a site + +Required scope | `users:read`
@@ -3446,27 +3597,13 @@ Add a registered script to a Site.

In order to use the Custom Code AP
```python -from webflow import ScriptApply, ScriptApplyLocation from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.sites.scripts.upsert_custom_code( - site_id="site_id", - scripts=[ - ScriptApply( - id="cms_slider", - location=ScriptApplyLocation.HEADER, - version="1.0.0", - attributes={"my-attribute": "some-value"}, - ), - ScriptApply( - id="alert", - location=ScriptApplyLocation.HEADER, - version="0.0.1", - ), - ], +client.access_groups.list( + site_id="580e63e98c9a982ac9b8b741", ) ``` @@ -3491,7 +3628,7 @@ client.sites.scripts.upsert_custom_code(
-**scripts:** `typing.Optional[typing.Sequence[ScriptApply]]` — A list of scripts applied to a Site or a Page +**offset:** `typing.Optional[float]` — Offset used for pagination if the results have more than limit records
@@ -3499,7 +3636,7 @@ client.sites.scripts.upsert_custom_code(
-**last_updated:** `typing.Optional[str]` — Date when the Site's scripts were last updated +**limit:** `typing.Optional[float]` — Maximum number of records to be returned (max limit: 100)
@@ -3507,7 +3644,10 @@ client.sites.scripts.upsert_custom_code(
-**created_on:** `typing.Optional[str]` — Date when the Site's scripts were created +**sort:** `typing.Optional[AccessGroupsListRequestSort]` + +Sort string to use when ordering access groups +Can be prefixed with a `-` to reverse the sort (ex. `-CreatedOn`)
@@ -3527,7 +3667,8 @@ client.sites.scripts.upsert_custom_code(
-
client.sites.scripts.delete_custom_code(...) +## Products +
client.products.list(...)
@@ -3539,7 +3680,12 @@ client.sites.scripts.upsert_custom_code(
-Delete the custom code block that an app created for a Site

Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:write` +Retrieve all products for a site. + +Use `limit` and `offset` to page through all products with subsequent requests. All SKUs for each product +will also be fetched and returned. The `limit`, `offset` and `total` values represent Products only and do not include any SKUs. + +Required scope | `ecommerce:read`
@@ -3559,8 +3705,8 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.sites.scripts.delete_custom_code( - site_id="site_id", +client.products.list( + site_id="580e63e98c9a982ac9b8b741", ) ``` @@ -3585,6 +3731,22 @@ client.sites.scripts.delete_custom_code(
+**offset:** `typing.Optional[float]` — Offset used for pagination if the results have more than limit records + +
+
+ +
+
+ +**limit:** `typing.Optional[float]` — Maximum number of records to be returned (max limit: 100) + +
+
+ +
+
+ **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -3597,7 +3759,7 @@ client.sites.scripts.delete_custom_code(
-
client.sites.scripts.list_custom_code_blocks(...) +
client.products.create(...)
@@ -3609,7 +3771,21 @@ client.sites.scripts.delete_custom_code(
-Get all instances of Custom Code applied to a Site or Pages.
Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:read` +Create a new product and SKU. + +When you create a product, you will always create a SKU, since a Product Item must have, at minimum, a single SKU. + +To create a Product with multiple SKUs - for example a T-shirt in sizes small, medium and large: + +- Create parameters in `sku-properties`, also known as [product options and variants.](https://help.webflow.com/hc/en-us/articles/33961334531347-Create-product-options-and-variants). +- A single `sku-property` would be `color`. Within the `color` property, list the various colors of T-shirts as an array of `enum` values: `royal-blue`, `crimson-red`, and `forrest-green`. +- Once, you've created a Product and its `sku-properties` with `enum` values, Webflow will create a **default SKU**, which will automatically be a combination of the first `sku-properties` you've created. +- In our example, the default SKU will be a Royal Blue T-Shirt, because our first `enum` of our Color `sku-property` is Royal Blue. +- After you've created your product, you can create additional SKUs using the [Create SKU endpoint.](/data/reference/ecommerce/products-sk-us/create-sku) + +Upon creation, the default product type will be `Advanced`, which ensures all Product and SKU fields will be shown to users in the Designer. + +Required scope | `ecommerce:write`
@@ -3629,8 +3805,8 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.sites.scripts.list_custom_code_blocks( - site_id="site_id", +client.products.create( + site_id="580e63e98c9a982ac9b8b741", ) ``` @@ -3655,7 +3831,7 @@ client.sites.scripts.list_custom_code_blocks(
-**offset:** `typing.Optional[float]` — Offset used for pagination if the results have more than limit records +**publish_status:** `typing.Optional[PublishStatus]`
@@ -3663,7 +3839,15 @@ client.sites.scripts.list_custom_code_blocks(
-**limit:** `typing.Optional[float]` — Maximum number of records to be returned (max limit: 100) +**product:** `typing.Optional[Product]` + +
+
+ +
+
+ +**sku:** `typing.Optional[Sku]`
@@ -3683,8 +3867,7 @@ client.sites.scripts.list_custom_code_blocks(
-## Scripts -
client.scripts.list(...) +
client.products.get(...)
@@ -3696,7 +3879,10 @@ client.sites.scripts.list_custom_code_blocks(
-List of scripts registered to a Site.

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints. Additionally, Scripts can be remotely hosted, or registered as inline snippets.
Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:read` +Retrieve a single product by its ID. All of its SKUs will also be +retrieved. + +Required scope | `ecommerce:read`
@@ -3716,8 +3902,9 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.scripts.list( - site_id="site_id", +client.products.get( + site_id="580e63e98c9a982ac9b8b741", + product_id="580e63fc8c9a982ac9b8b745", ) ``` @@ -3742,6 +3929,14 @@ client.scripts.list(
+**product_id:** `str` — Unique identifier for a Product + +
+
+ +
+
+ **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -3754,7 +3949,7 @@ client.scripts.list(
-
client.scripts.register_hosted(...) +
client.products.update(...)
@@ -3766,7 +3961,11 @@ client.scripts.list(
-Add a script to a Site's Custom Code registry.

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints. Additionally, Scripts can be remotely hosted, or registered as inline snippets.
Access to this endpoint requires a bearer token from a Data Client App.


Required scope | `custom_code:write` +Update an existing Product. + +Updating an existing Product will set the product type to `Advanced`, which ensures all Product and SKU fields will be shown to users in the Designer. + +Required scope | `ecommerce:write`
@@ -3786,12 +3985,9 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.scripts.register_hosted( - site_id="site_id", - hosted_location="hostedLocation", - integrity_hash="integrityHash", - version="version", - display_name="displayName", +client.products.update( + site_id="580e63e98c9a982ac9b8b741", + product_id="580e63fc8c9a982ac9b8b745", ) ``` @@ -3816,15 +4012,7 @@ client.scripts.register_hosted(
-**hosted_location:** `str` — URI for an externally hosted script location - -
-
- -
-
- -**integrity_hash:** `str` — Sub-Resource Integrity Hash +**product_id:** `str` — Unique identifier for a Product
@@ -3832,7 +4020,7 @@ client.scripts.register_hosted(
-**version:** `str` — A Semantic Version (SemVer) string, denoting the version of the script +**publish_status:** `typing.Optional[PublishStatus]`
@@ -3840,7 +4028,7 @@ client.scripts.register_hosted(
-**display_name:** `str` — User-facing name for the script. Must be between 1 and 50 alphanumeric characters +**product:** `typing.Optional[Product]`
@@ -3848,7 +4036,7 @@ client.scripts.register_hosted(
-**can_copy:** `typing.Optional[bool]` — Define whether the script can be copied on site duplication and transfer +**sku:** `typing.Optional[Sku]`
@@ -3868,7 +4056,7 @@ client.scripts.register_hosted(
-
client.scripts.register_inline(...) +
client.products.create_sku(...)
@@ -3880,7 +4068,11 @@ client.scripts.register_hosted(
-Add a script to a Site's Custom Code registry. Inline scripts can be between 1 and 2000 characters.

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints.

Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:write` +Create additional SKUs to manage every [option and variant of your Product.](https://help.webflow.com/hc/en-us/articles/33961334531347-Create-product-options-and-variants) + +Creating SKUs through the API will set the product type to `Advanced`, which ensures all Product and SKU fields will be shown to users in the Designer. + +Required scope | `ecommerce:write`
@@ -3895,16 +4087,16 @@ Add a script to a Site's Custom Code registry. Inline scripts can be between 1 a
```python +from webflow import Sku from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.scripts.register_inline( - site_id="site_id", - source_code="alert('hello world');", - version="0.0.1", - display_name="Alert", +client.products.create_sku( + site_id="580e63e98c9a982ac9b8b741", + product_id="580e63fc8c9a982ac9b8b745", + skus=[Sku()], ) ``` @@ -3929,23 +4121,7 @@ client.scripts.register_inline(
-**source_code:** `str` — The code to be added to the site (to be hosted by Webflow). - -
-
- -
-
- -**version:** `str` — A Semantic Version (SemVer) string, denoting the version of the script - -
-
- -
-
- -**display_name:** `str` — User-facing name for the script. Must be between 1 and 50 alphanumeric characters +**product_id:** `str` — Unique identifier for a Product
@@ -3953,7 +4129,7 @@ client.scripts.register_inline(
-**integrity_hash:** `typing.Optional[str]` — Sub-Resource Integrity Hash. Only required for externally hosted scripts (passed via hostedLocation) +**skus:** `typing.Sequence[Sku]` — An array of the SKU data your are adding
@@ -3961,7 +4137,7 @@ client.scripts.register_inline(
-**can_copy:** `typing.Optional[bool]` — Define whether the script can be copied on site duplication and transfer +**publish_status:** `typing.Optional[PublishStatus]`
@@ -3981,8 +4157,7 @@ client.scripts.register_inline(
-## Assets -
client.assets.list(...) +
client.products.update_sku(...)
@@ -3994,7 +4169,11 @@ client.scripts.register_inline(
-List assets for a given site

Required scope | `assets:read` +Update a specified SKU. + +Updating an existing SKU will set the Product type to `Advanced`, which ensures all Product and SKU fields will be shown to users in the Designer. + +Required scope | `ecommerce:write`
@@ -4009,13 +4188,17 @@ List assets for a given site

Required scope | `assets:read`
```python +from webflow import Sku from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.assets.list( - site_id="site_id", +client.products.update_sku( + site_id="580e63e98c9a982ac9b8b741", + product_id="580e63fc8c9a982ac9b8b745", + sku_id="5e8518516e147040726cc415", + sku=Sku(), ) ``` @@ -4040,6 +4223,38 @@ client.assets.list(
+**product_id:** `str` — Unique identifier for a Product + +
+
+ +
+
+ +**sku_id:** `str` — Unique identifier for a SKU + +
+
+ +
+
+ +**sku:** `Sku` + +
+
+ +
+
+ +**publish_status:** `typing.Optional[PublishStatus]` + +
+
+ +
+
+ **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -4052,7 +4267,8 @@ client.assets.list(
-
client.assets.create(...) +## Orders +
client.orders.list(...)
@@ -4064,7 +4280,9 @@ client.assets.list(
-Create a new asset entry.

This endpoint generates a response with the following information: `uploadUrl` and `uploadDetails`. You can use these two properties to [upload the file to Amazon s3 by making a POST](https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPOST.html) request to the `uploadUrl` with the `uploadDetails` object as your header information in the request.

Required scope | `assets:write` +List all orders created for a given site. + +Required scope | `ecommerce:read`
@@ -4084,10 +4302,8 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.assets.create( - site_id="site_id", - file_name="file.png", - file_hash="3c7d87c9575702bc3b1e991f4d3c638e", +client.orders.list( + site_id="580e63e98c9a982ac9b8b741", ) ``` @@ -4112,7 +4328,7 @@ client.assets.create(
-**file_name:** `str` — file name including file extension +**status:** `typing.Optional[OrdersListRequestStatus]` — Filter the orders by status
@@ -4120,7 +4336,7 @@ client.assets.create(
-**file_hash:** `str` — MD5 hash of the file +**offset:** `typing.Optional[float]` — Offset used for pagination if the results have more than limit records
@@ -4128,7 +4344,7 @@ client.assets.create(
-**parent_folder:** `typing.Optional[str]` — id of the Asset folder (optional) +**limit:** `typing.Optional[float]` — Maximum number of records to be returned (max limit: 100)
@@ -4148,7 +4364,7 @@ client.assets.create(
-
client.assets.get(...) +
client.orders.get(...)
@@ -4160,7 +4376,10 @@ client.assets.create(
-Get an Asset

Required scope | `assets:read` +Retrieve a single product by its ID. All of its SKUs will also be +retrieved. + +Required scope | `ecommerce:read`
@@ -4180,8 +4399,9 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.assets.get( - asset_id="asset_id", +client.orders.get( + site_id="580e63e98c9a982ac9b8b741", + order_id="5e8518516e147040726cc415", ) ``` @@ -4198,7 +4418,15 @@ client.assets.get(
-**asset_id:** `str` — Unique identifier for an Asset on a site +**site_id:** `str` — Unique identifier for a Site + +
+
+ +
+
+ +**order_id:** `str` — Unique identifier for an Order
@@ -4218,7 +4446,7 @@ client.assets.get(
-
client.assets.delete(...) +
client.orders.update(...)
@@ -4230,7 +4458,11 @@ client.assets.get(
-Delete an Asset +This API lets you update the fields, `comment`, `shippingProvider`, +and/or `shippingTracking` for a given order. All three fields can be +updated simultaneously or independently. + +Required scope | `ecommerce:write`
@@ -4250,8 +4482,9 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.assets.delete( - asset_id="asset_id", +client.orders.update( + site_id="580e63e98c9a982ac9b8b741", + order_id="5e8518516e147040726cc415", ) ``` @@ -4268,7 +4501,47 @@ client.assets.delete(
-**asset_id:** `str` — Unique identifier for an Asset on a site +**site_id:** `str` — Unique identifier for a Site + +
+
+ +
+
+ +**order_id:** `str` — Unique identifier for an Order + +
+
+ +
+
+ +**comment:** `typing.Optional[str]` — Arbitrary data for your records + +
+
+ +
+
+ +**shipping_provider:** `typing.Optional[str]` — Company or method used to ship order + +
+
+ +
+
+ +**shipping_tracking:** `typing.Optional[str]` — Tracking number for order shipment + +
+
+ +
+
+ +**shipping_tracking_url:** `typing.Optional[str]` — URL to track order shipment
@@ -4288,7 +4561,7 @@ client.assets.delete(
-
client.assets.update(...) +
client.orders.update_fulfill(...)
@@ -4300,7 +4573,9 @@ client.assets.delete(
-Update an Asset

Required scope | `assets:write` +Updates an order's status to fulfilled + +Required scope | `ecommerce:write`
@@ -4320,9 +4595,9 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.assets.update( - asset_id="asset_id", - display_name="bulldoze.png", +client.orders.update_fulfill( + site_id="580e63e98c9a982ac9b8b741", + order_id="5e8518516e147040726cc415", ) ``` @@ -4339,7 +4614,15 @@ client.assets.update(
-**asset_id:** `str` — Unique identifier for an Asset on a site +**site_id:** `str` — Unique identifier for a Site + +
+
+ +
+
+ +**order_id:** `str` — Unique identifier for an Order
@@ -4347,7 +4630,7 @@ client.assets.update(
-**display_name:** `str` — file name including file extension +**send_order_fulfilled_email:** `typing.Optional[bool]` — Whether or not the Order Fulfilled email should be sent
@@ -4367,7 +4650,7 @@ client.assets.update(
-
client.assets.list_folders(...) +
client.orders.update_unfulfill(...)
@@ -4379,7 +4662,9 @@ client.assets.update(
-List Asset Folders within a given site

Required scope | `assets:read` +Updates an order's status to unfulfilled + +Required scope | `ecommerce:write`
@@ -4399,8 +4684,9 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.assets.list_folders( - site_id="site_id", +client.orders.update_unfulfill( + site_id="580e63e98c9a982ac9b8b741", + order_id="5e8518516e147040726cc415", ) ``` @@ -4425,6 +4711,14 @@ client.assets.list_folders(
+**order_id:** `str` — Unique identifier for an Order + +
+
+ +
+
+ **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -4437,7 +4731,7 @@ client.assets.list_folders(
-
client.assets.create_folder(...) +
client.orders.refund(...)
@@ -4449,7 +4743,10 @@ client.assets.list_folders(
-Create an Asset Folder within a given site

Required scope | `assets:write` +This API will reverse a Stripe charge and refund an order back to a +customer. It will also set the order's status to `refunded`. + +Required scope | `ecommerce:write`
@@ -4469,9 +4766,9 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.assets.create_folder( - site_id="site_id", - display_name="my asset folder", +client.orders.refund( + site_id="580e63e98c9a982ac9b8b741", + order_id="5e8518516e147040726cc415", ) ``` @@ -4496,7 +4793,7 @@ client.assets.create_folder(
-**display_name:** `str` — A human readable name for the Asset Folder +**order_id:** `str` — Unique identifier for an Order
@@ -4504,7 +4801,7 @@ client.assets.create_folder(
-**parent_folder:** `typing.Optional[str]` — An (optional) pointer to a parent Asset Folder (or null for root) +**reason:** `typing.Optional[OrdersRefundRequestReason]` — The reason for the refund
@@ -4524,7 +4821,8 @@ client.assets.create_folder(
-
client.assets.get_folder(...) +## Inventory +
client.inventory.list(...)
@@ -4536,7 +4834,9 @@ client.assets.create_folder(
-Get details about a specific Asset Folder

Required scope | `assets:read` +List the current inventory levels for a particular SKU item. + +Required scope | `ecommerce:read`
@@ -4556,8 +4856,9 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.assets.get_folder( - asset_folder_id="asset_folder_id", +client.inventory.list( + collection_id="580e63fc8c9a982ac9b8b745", + item_id="580e64008c9a982ac9b8b754", ) ``` @@ -4574,7 +4875,15 @@ client.assets.get_folder(
-**asset_folder_id:** `str` — Unique identifier for an Asset Folder +**collection_id:** `str` — Unique identifier for a Collection + +
+
+ +
+
+ +**item_id:** `str` — Unique identifier for an Item
@@ -4594,8 +4903,7 @@ client.assets.get_folder(
-## Webhooks -
client.webhooks.list(...) +
client.inventory.update(...)
@@ -4607,7 +4915,14 @@ client.assets.get_folder(
-List all App-created Webhooks registered for a given site

Required scope | `sites:read` +Updates the current inventory levels for a particular SKU item. + +Updates may be given in one or two methods, absolutely or incrementally. + +- Absolute updates are done by setting `quantity` directly. +- Incremental updates are by specifying the inventory delta in `updateQuantity` which is then added to the `quantity` stored on the server. + +Required scope | `ecommerce:write`
@@ -4622,13 +4937,16 @@ List all App-created Webhooks registered for a given site

Required sc
```python +from webflow import InventoryUpdateRequestInventoryType from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.webhooks.list( - site_id="site_id", +client.inventory.update( + collection_id="580e63fc8c9a982ac9b8b745", + item_id="580e64008c9a982ac9b8b754", + inventory_type=InventoryUpdateRequestInventoryType.INFINITE, ) ``` @@ -4645,7 +4963,39 @@ client.webhooks.list(
-**site_id:** `str` — Unique identifier for a Site +**collection_id:** `str` — Unique identifier for a Collection + +
+
+ +
+
+ +**item_id:** `str` — Unique identifier for an Item + +
+
+ +
+
+ +**inventory_type:** `InventoryUpdateRequestInventoryType` — infinite or finite + +
+
+ +
+
+ +**update_quantity:** `typing.Optional[float]` — Adds this quantity to currently store quantity. Can be negative. + +
+
+ +
+
+ +**quantity:** `typing.Optional[float]` — Immediately sets quantity to this value.
@@ -4665,7 +5015,8 @@ client.webhooks.list(
-
client.webhooks.create(...) +## Ecommerce +
client.ecommerce.get_settings(...)
@@ -4677,7 +5028,9 @@ client.webhooks.list(
-Create a new Webhook, to be notified when Webflow resources change. Limit of 75 registrations per `triggerType`, per site.
Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `sites:write` +Retrieve ecommerce settings for a site. + +Required scope | `ecommerce:read`
@@ -4692,16 +5045,13 @@ Create a new Webhook, to be notified when Webflow resources change. Limit of 75
```python -from webflow import TriggerType from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.webhooks.create( - site_id="site_id", - trigger_type=TriggerType.FORM_SUBMISSION, - url="https://api.mydomain.com/webhook", +client.ecommerce.get_settings( + site_id="580e63e98c9a982ac9b8b741", ) ``` @@ -4720,35 +5070,6 @@ client.webhooks.create( **site_id:** `str` — Unique identifier for a Site -
-
- -
-
- -**trigger_type:** `TriggerType` - -
-
- -
-
- -**url:** `str` — The server URI that Webflow will call when your Webhook is triggered - - -
-
- -
-
- -**filter:** `typing.Optional[typing.Dict[str, typing.Any]]` - -Filter for selecting which events you want Webhooks to be triggered for. -** Only available for `form_submission` trigger types. ** - -
@@ -4767,7 +5088,8 @@ Filter for selecting which events you want Webhooks to be triggered for.
-
client.webhooks.get(...) +## Collections Fields +
client.collections.fields.create(...)
@@ -4779,7 +5101,16 @@ Filter for selecting which events you want Webhooks to be triggered for.
-Get a specific Webhook instance +Create a custom field in a collection. + +Slugs must be all lowercase letters without spaces. +If you pass a string with uppercase letters and/or spaces to the "Slug" property, Webflow will +convert the slug to lowercase and replace spaces with "-." + +Only some field types can be created through the API. +This endpoint does not currently support bulk creation. + +Required scope | `cms:write`
@@ -4795,12 +5126,17 @@ Get a specific Webhook instance ```python from webflow.client import Webflow +from webflow.resources.collections import FieldCreateType client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.webhooks.get( - webhook_id="webhook_id", +client.collections.fields.create( + collection_id="580e63fc8c9a982ac9b8b745", + is_required=False, + type=FieldCreateType.RICH_TEXT, + display_name="Post Body", + help_text="Add the body of your post here", ) ``` @@ -4817,7 +5153,39 @@ client.webhooks.get(
-**webhook_id:** `str` — Unique identifier for a Webhook +**collection_id:** `str` — Unique identifier for a Collection + +
+
+ +
+
+ +**type:** `FieldCreateType` — Choose these appropriate field type for your collection data + +
+
+ +
+
+ +**display_name:** `str` — The name of a field + +
+
+ +
+
+ +**is_required:** `typing.Optional[bool]` — define whether a field is required in a collection + +
+
+ +
+
+ +**help_text:** `typing.Optional[str]` — Additional text to help anyone filling out this field
@@ -4837,7 +5205,7 @@ client.webhooks.get(
-
client.webhooks.delete(...) +
client.collections.fields.delete(...)
@@ -4849,7 +5217,9 @@ client.webhooks.get(
-Remove a Webhook +Delete a custom field in a collection. This endpoint does not currently support bulk deletion. + +Required scope | `cms:write`
@@ -4869,8 +5239,9 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.webhooks.delete( - webhook_id="webhook_id", +client.collections.fields.delete( + collection_id="580e63fc8c9a982ac9b8b745", + field_id="580e63fc8c9a982ac9b8b745", ) ``` @@ -4887,7 +5258,15 @@ client.webhooks.delete(
-**webhook_id:** `str` — Unique identifier for a Webhook +**collection_id:** `str` — Unique identifier for a Collection + +
+
+ +
+
+ +**field_id:** `str` — Unique identifier for a Field in a collection
@@ -4907,8 +5286,7 @@ client.webhooks.delete(
-## Forms -
client.forms.list(...) +
client.collections.fields.update(...)
@@ -4920,7 +5298,9 @@ client.webhooks.delete(
-List forms for a given site

Required scope | `forms:read` +Update a custom field in a collection. + +Required scope | `cms:write`
@@ -4940,8 +5320,12 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.forms.list( - site_id="site_id", +client.collections.fields.update( + collection_id="580e63fc8c9a982ac9b8b745", + field_id="580e63fc8c9a982ac9b8b745", + is_required=False, + display_name="Post Body", + help_text="Add the body of your post here", ) ``` @@ -4958,7 +5342,7 @@ client.forms.list(
-**site_id:** `str` — Unique identifier for a Site +**collection_id:** `str` — Unique identifier for a Collection
@@ -4966,7 +5350,7 @@ client.forms.list(
-**limit:** `typing.Optional[float]` — Maximum number of records to be returned (max limit: 100) +**field_id:** `str` — Unique identifier for a Field in a collection
@@ -4974,7 +5358,23 @@ client.forms.list(
-**offset:** `typing.Optional[float]` — Offset used for pagination if the results have more than limit records +**is_required:** `typing.Optional[bool]` — Define whether a field is required in a collection + +
+
+ +
+
+ +**display_name:** `typing.Optional[str]` — The name of a field + +
+
+ +
+
+ +**help_text:** `typing.Optional[str]` — Additional text to help anyone filling out this field
@@ -4994,7 +5394,8 @@ client.forms.list(
-
client.forms.get(...) +## Collections Items +
client.collections.items.list_items(...)
@@ -5006,7 +5407,9 @@ client.forms.list(
-Get information about a given form

Required scope | `forms:read` +List of all Items within a Collection. + +Required scope | `CMS:read`
@@ -5026,8 +5429,8 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.forms.get( - form_id="form_id", +client.collections.items.list_items( + collection_id="580e63fc8c9a982ac9b8b745", ) ``` @@ -5044,7 +5447,63 @@ client.forms.get(
-**form_id:** `str` — Unique identifier for a Form +**collection_id:** `str` — Unique identifier for a Collection + +
+
+ +
+
+ +**cms_locale_id:** `typing.Optional[str]` — Unique identifier for a CMS Locale. This UID is different from the Site locale identifier and is listed as `cmsLocaleId` in the Sites response. To query multiple locales, input a comma separated string. + +
+
+ +
+
+ +**offset:** `typing.Optional[float]` — Offset used for pagination if the results have more than limit records + +
+
+ +
+
+ +**limit:** `typing.Optional[float]` — Maximum number of records to be returned (max limit: 100) + +
+
+ +
+
+ +**name:** `typing.Optional[str]` — The name of the item(s) + +
+
+ +
+
+ +**slug:** `typing.Optional[str]` — The slug of the item + +
+
+ +
+
+ +**sort_by:** `typing.Optional[ItemsListItemsRequestSortBy]` — Sort results by the provided value + +
+
+ +
+
+ +**sort_order:** `typing.Optional[ItemsListItemsRequestSortOrder]` — Sorts the results by asc or desc
@@ -5064,7 +5523,7 @@ client.forms.get(
-
client.forms.list_submissions(...) +
client.collections.items.create_item(...)
@@ -5076,7 +5535,11 @@ client.forms.get(
-List form submissions for a given form

Required scope | `forms:read` +Create Item(s) in a Collection. + +To create items across multiple locales, please use [this endpoint.](/v2.0.0/data/reference/cms/collection-items/staged-items/create-items) + +Required scope | `CMS:write`
@@ -5091,13 +5554,35 @@ List form submissions for a given form

Required scope | `forms:read`
```python +from webflow import CollectionItemPostSingle, CollectionItemPostSingleFieldData from webflow.client import Webflow +from webflow.resources.collections import MultipleItems client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.forms.list_submissions( - form_id="form_id", +client.collections.items.create_item( + collection_id="580e63fc8c9a982ac9b8b745", + request=MultipleItems( + items=[ + CollectionItemPostSingle( + is_archived=False, + is_draft=False, + field_data=CollectionItemPostSingleFieldData( + name="Senior Data Analyst", + slug="senior-data-analyst", + ), + ), + CollectionItemPostSingle( + is_archived=False, + is_draft=False, + field_data=CollectionItemPostSingleFieldData( + name="Product Manager", + slug="product-manager", + ), + ), + ], + ), ) ``` @@ -5114,7 +5599,15 @@ client.forms.list_submissions(
-**form_id:** `str` — Unique identifier for a Form +**collection_id:** `str` — Unique identifier for a Collection + +
+
+ +
+
+ +**request:** `ItemsCreateItemRequest`
@@ -5134,7 +5627,7 @@ client.forms.list_submissions(
-
client.forms.get_submission(...) +
client.collections.items.delete_items(...)
@@ -5146,7 +5639,11 @@ client.forms.list_submissions(
-Get information about a given form submission

Required scope | `forms:read` +Delete Items from a Collection. + +**Note:** If the `cmsLocaleId` parameter is undefined or empty and the items are localized, items will be deleted only in the primary locale. + +Required scope | `CMS:write`
@@ -5166,8 +5663,8 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.forms.get_submission( - form_submission_id="form_submission_id", +client.collections.items.delete_items( + collection_id="580e63fc8c9a982ac9b8b745", ) ``` @@ -5184,7 +5681,15 @@ client.forms.get_submission(
-**form_submission_id:** `str` — Unique identifier for a Form Submission +**collection_id:** `str` — Unique identifier for a Collection + +
+
+ +
+
+ +**items:** `typing.Optional[typing.Sequence[ItemsDeleteItemsRequestItemsItem]]`
@@ -5204,7 +5709,7 @@ client.forms.get_submission(
-
client.forms.update_submission(...) +
client.collections.items.update_items(...)
@@ -5216,7 +5721,11 @@ client.forms.get_submission(
-Update hidden fields on a form submission

Required scope | `forms:write` +Update a single item or multiple items (up to 100) in a Collection. + +**Note:** If the `cmsLocaleId` parameter is undefined or empty and the items are localized, items will be updated only in the primary locale. + +Required scope | `CMS:write`
@@ -5231,13 +5740,51 @@ Update hidden fields on a form submission

Required scope | `forms:writ
```python +from webflow import ( + CollectionItemWithIdInput, + CollectionItemWithIdInputFieldData, +) from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.forms.update_submission( - form_submission_id="form_submission_id", +client.collections.items.update_items( + collection_id="580e63fc8c9a982ac9b8b745", + items=[ + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5ea6", + cms_locale_id="66f6e966c9e1dc700a857ca5", + field_data=CollectionItemWithIdInputFieldData( + name="Ne Paniquez Pas", + slug="ne-paniquez-pas", + ), + ), + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5ea6", + cms_locale_id="66f6e966c9e1dc700a857ca4", + field_data=CollectionItemWithIdInputFieldData( + name="No Entrar en Pánico", + slug="no-entrar-en-panico", + ), + ), + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5eaa", + cms_locale_id="66f6e966c9e1dc700a857ca5", + field_data=CollectionItemWithIdInputFieldData( + name="Au Revoir et Merci pour Tous les Poissons", + slug="au-revoir-et-merci", + ), + ), + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5eaa", + cms_locale_id="66f6e966c9e1dc700a857ca4", + field_data=CollectionItemWithIdInputFieldData( + name="Hasta Luego y Gracias por Todo el Pescado", + slug="hasta-luego-y-gracias", + ), + ), + ], ) ``` @@ -5254,7 +5801,7 @@ client.forms.update_submission(
-**form_submission_id:** `str` — Unique identifier for a Form Submission +**collection_id:** `str` — Unique identifier for a Collection
@@ -5262,7 +5809,7 @@ client.forms.update_submission(
-**form_submission_data:** `typing.Optional[typing.Dict[str, typing.Any]]` — An existing **hidden field** defined on the form schema, and the corresponding value to set +**items:** `typing.Optional[typing.Sequence[CollectionItemWithIdInput]]`
@@ -5282,8 +5829,7 @@ client.forms.update_submission(
-## Users -
client.users.list(...) +
client.collections.items.list_items_live(...)
@@ -5295,7 +5841,9 @@ client.forms.update_submission(
-Get a list of users for a site

Required scope | `users:read` +List of all live Items within a Collection. + +Required scope | `CMS:read`
@@ -5315,8 +5863,8 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.users.list( - site_id="site_id", +client.collections.items.list_items_live( + collection_id="580e63fc8c9a982ac9b8b745", ) ``` @@ -5333,7 +5881,15 @@ client.users.list(
-**site_id:** `str` — Unique identifier for a Site +**collection_id:** `str` — Unique identifier for a Collection + +
+
+ +
+
+ +**cms_locale_id:** `typing.Optional[str]` — Unique identifier for a CMS Locale. This UID is different from the Site locale identifier and is listed as `cmsLocaleId` in the Sites response. To query multiple locales, input a comma separated string.
@@ -5357,13 +5913,31 @@ client.users.list(
-**sort:** `typing.Optional[UsersListRequestSort]` +**name:** `typing.Optional[str]` — The name of the item(s) + +
+
-Sort string to use when ordering users +
+
-Example(`CreatedOn`, `Email`, `Status`, `LastLogin`, `UpdatedOn`). +**slug:** `typing.Optional[str]` — The slug of the item + +
+
-Can be prefixed with a `-` to reverse the sort (ex. `-CreatedOn`) +
+
+ +**sort_by:** `typing.Optional[ItemsListItemsLiveRequestSortBy]` — Sort results by the provided value + +
+
+ +
+
+ +**sort_order:** `typing.Optional[ItemsListItemsLiveRequestSortOrder]` — Sorts the results by asc or desc
@@ -5383,7 +5957,7 @@ Can be prefixed with a `-` to reverse the sort (ex. `-CreatedOn`)
-
client.users.get(...) +
client.collections.items.create_item_live(...)
@@ -5395,7 +5969,11 @@ Can be prefixed with a `-` to reverse the sort (ex. `-CreatedOn`)
-Get a User by ID

Required scope | `users:read` +Create live Item(s) in a Collection. The Item(s) will be published to the live site. + +To create items across multiple locales, [please use this endpoint.](/v2.0.0/data/reference/cms/collection-items/staged-items/create-items) + +Required scope | `CMS:write`
@@ -5410,14 +5988,35 @@ Get a User by ID

Required scope | `users:read`
```python +from webflow import CollectionItem, CollectionItemFieldData from webflow.client import Webflow +from webflow.resources.collections import MultipleLiveItems client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.users.get( - site_id="site_id", - user_id="user_id", +client.collections.items.create_item_live( + collection_id="580e63fc8c9a982ac9b8b745", + request=MultipleLiveItems( + items=[ + CollectionItem( + is_archived=False, + is_draft=False, + field_data=CollectionItemFieldData( + name="Senior Data Analyst", + slug="senior-data-analyst", + ), + ), + CollectionItem( + is_archived=False, + is_draft=False, + field_data=CollectionItemFieldData( + name="Product Manager", + slug="product-manager", + ), + ), + ], + ), ) ``` @@ -5434,7 +6033,7 @@ client.users.get(
-**site_id:** `str` — Unique identifier for a Site +**collection_id:** `str` — Unique identifier for a Collection
@@ -5442,7 +6041,7 @@ client.users.get(
-**user_id:** `str` — Unique identifier for a User +**request:** `ItemsCreateItemLiveRequest`
@@ -5462,7 +6061,7 @@ client.users.get(
-
client.users.delete(...) +
client.collections.items.delete_items_live(...)
@@ -5474,7 +6073,11 @@ client.users.get(
-Delete a User by ID

Required scope | `users:write` +Remove an item or multiple items (up to 100 items) from the live site. Deleting published items will unpublish the items from the live site and set them to draft. + +**Note:** If the `cmsLocaleId` parameter is undefined or empty and the items are localized, items will be unpublished only in the primary locale. + +Required scope | `CMS:write`
@@ -5494,9 +6097,8 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.users.delete( - site_id="site_id", - user_id="user_id", +client.collections.items.delete_items_live( + collection_id="580e63fc8c9a982ac9b8b745", ) ``` @@ -5513,7 +6115,7 @@ client.users.delete(
-**site_id:** `str` — Unique identifier for a Site +**collection_id:** `str` — Unique identifier for a Collection
@@ -5521,7 +6123,7 @@ client.users.delete(
-**user_id:** `str` — Unique identifier for a User +**items:** `typing.Optional[typing.Sequence[ItemsDeleteItemsLiveRequestItemsItem]]`
@@ -5541,7 +6143,7 @@ client.users.delete(
-
client.users.update(...) +
client.collections.items.update_items_live(...)
@@ -5553,9 +6155,11 @@ client.users.delete(
-Update a User by ID

Required scope | `users:write` +Update a single live item or multiple live items (up to 100) in a Collection - +**Note:** If the `cmsLocaleId` parameter is undefined or empty and the items are localized, items will be updated only in the primary locale. + +Required scope | `CMS:write`
@@ -5570,21 +6174,51 @@ Update a User by ID

Required scope | `users:write`
```python -from webflow import UsersUpdateRequestData +from webflow import ( + CollectionItemWithIdInput, + CollectionItemWithIdInputFieldData, +) from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.users.update( - site_id="site_id", - user_id="user_id", - data=UsersUpdateRequestData( - name="Some One", - accept_privacy=False, - accept_communications=False, - ), - access_groups=["webflowers", "platinum", "free-tier"], +client.collections.items.update_items_live( + collection_id="580e63fc8c9a982ac9b8b745", + items=[ + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5ea6", + cms_locale_id="66f6e966c9e1dc700a857ca5", + field_data=CollectionItemWithIdInputFieldData( + name="Ne Paniquez Pas", + slug="ne-paniquez-pas", + ), + ), + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5ea6", + cms_locale_id="66f6e966c9e1dc700a857ca4", + field_data=CollectionItemWithIdInputFieldData( + name="No Entrar en Pánico", + slug="no-entrar-en-panico", + ), + ), + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5eaa", + cms_locale_id="66f6e966c9e1dc700a857ca5", + field_data=CollectionItemWithIdInputFieldData( + name="Au Revoir et Merci pour Tous les Poissons", + slug="au-revoir-et-merci", + ), + ), + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5eaa", + cms_locale_id="66f6e966c9e1dc700a857ca4", + field_data=CollectionItemWithIdInputFieldData( + name="Hasta Luego y Gracias por Todo el Pescado", + slug="hasta-luego-y-gracias", + ), + ), + ], ) ``` @@ -5601,23 +6235,7 @@ client.users.update(
-**site_id:** `str` — Unique identifier for a Site - -
-
- -
-
- -**user_id:** `str` — Unique identifier for a User - -
-
- -
-
- -**data:** `typing.Optional[UsersUpdateRequestData]` +**collection_id:** `str` — Unique identifier for a Collection
@@ -5625,8 +6243,7 @@ client.users.update(
-**access_groups:** `typing.Optional[typing.Sequence[str]]` — An array of access group slugs. Access groups are assigned to the user as type `admin` and the user remains in the group until removed. - +**items:** `typing.Optional[typing.Sequence[CollectionItemWithIdInput]]`
@@ -5646,7 +6263,7 @@ client.users.update(
-
client.users.invite(...) +
client.collections.items.create_items(...)
@@ -5658,7 +6275,14 @@ client.users.update(
-Create and invite a user with an email address. The user will be sent and invite via email, which they will need to accept in order to join paid Access Groups.

Required scope | `users:write` +Create an item or multiple items in a CMS Collection across multiple corresponding locales. + +**Notes:** + +- This endpoint can create up to 100 items in a request. +- If the `cmsLocaleIds` parameter is undefined or empty and localization is enabled, items will only be created in the primary locale. + +Required scope | `CMS:write`
@@ -5674,14 +6298,24 @@ Create and invite a user with an email address. The user will be sent and invite ```python from webflow.client import Webflow +from webflow.resources.collections import SingleCmsItem client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.users.invite( - site_id="site_id", - email="some.one@home.com", - access_groups=["webflowers"], +client.collections.items.create_items( + collection_id="580e63fc8c9a982ac9b8b745", + cms_locale_ids=[ + "66f6e966c9e1dc700a857ca3", + "66f6e966c9e1dc700a857ca4", + "66f6e966c9e1dc700a857ca5", + ], + is_archived=False, + is_draft=False, + field_data=SingleCmsItem( + name="Don’t Panic", + slug="dont-panic", + ), ) ``` @@ -5698,7 +6332,7 @@ client.users.invite(
-**site_id:** `str` — Unique identifier for a Site +**collection_id:** `str` — Unique identifier for a Collection
@@ -5706,7 +6340,7 @@ client.users.invite(
-**email:** `str` — Email address of user to send invite to +**field_data:** `CreateBulkCollectionItemRequestBodyFieldData`
@@ -5714,8 +6348,23 @@ client.users.invite(
-**access_groups:** `typing.Optional[typing.Sequence[str]]` — An array of access group slugs. Access groups are assigned to the user as type `admin` and the user remains in the group until removed. +**cms_locale_ids:** `typing.Optional[typing.Sequence[str]]` — Array of identifiers for the locales where the item will be created + +
+
+ +
+
+ +**is_archived:** `typing.Optional[bool]` — Indicates whether the item is archived. + +
+
+ +
+
+**is_draft:** `typing.Optional[bool]` — Indicates whether the item is in draft state.
@@ -5735,8 +6384,7 @@ client.users.invite(
-## AccessGroups -
client.access_groups.list(...) +
client.collections.items.get_item(...)
@@ -5748,7 +6396,9 @@ client.users.invite(
-Get a list of access groups for a site

Required scope | `users:read` +Get details of a selected Collection Item. + +Required scope | `CMS:read`
@@ -5768,8 +6418,9 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.access_groups.list( - site_id="site_id", +client.collections.items.get_item( + collection_id="580e63fc8c9a982ac9b8b745", + item_id="580e64008c9a982ac9b8b754", ) ``` @@ -5786,15 +6437,7 @@ client.access_groups.list(
-**site_id:** `str` — Unique identifier for a Site - -
-
- -
-
- -**offset:** `typing.Optional[float]` — Offset used for pagination if the results have more than limit records +**collection_id:** `str` — Unique identifier for a Collection
@@ -5802,7 +6445,7 @@ client.access_groups.list(
-**limit:** `typing.Optional[float]` — Maximum number of records to be returned (max limit: 100) +**item_id:** `str` — Unique identifier for an Item
@@ -5810,10 +6453,7 @@ client.access_groups.list(
-**sort:** `typing.Optional[AccessGroupsListRequestSort]` - -Sort string to use when ordering access groups -Can be prefixed with a `-` to reverse the sort (ex. `-CreatedOn`) +**cms_locale_id:** `typing.Optional[str]` — Unique identifier for a CMS Locale. This UID is different from the Site locale identifier and is listed as `cmsLocaleId` in the Sites response. To query multiple locales, input a comma separated string.
@@ -5833,8 +6473,7 @@ Can be prefixed with a `-` to reverse the sort (ex. `-CreatedOn`)
-## Products -
client.products.list(...) +
client.collections.items.delete_item(...)
@@ -5846,9 +6485,9 @@ Can be prefixed with a `-` to reverse the sort (ex. `-CreatedOn`)
-Retrieve all products for a site. Use `limit` and `offset` to page through all products with subsequent requests. All SKUs for each product will also be fetched and returned. The `limit`, `offset` and `total` values represent Products only and do not include any SKUs. +Delete an Item from a Collection. This endpoint does not currently support bulk deletion. -Required scope | `ecommerce:read` +Required scope | `CMS:write`
@@ -5868,8 +6507,9 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.products.list( - site_id="site_id", +client.collections.items.delete_item( + collection_id="580e63fc8c9a982ac9b8b745", + item_id="580e64008c9a982ac9b8b754", ) ``` @@ -5886,7 +6526,7 @@ client.products.list(
-**site_id:** `str` — Unique identifier for a Site +**collection_id:** `str` — Unique identifier for a Collection
@@ -5894,7 +6534,7 @@ client.products.list(
-**offset:** `typing.Optional[float]` — Offset used for pagination if the results have more than limit records +**item_id:** `str` — Unique identifier for an Item
@@ -5902,7 +6542,7 @@ client.products.list(
-**limit:** `typing.Optional[float]` — Maximum number of records to be returned (max limit: 100) +**cms_locale_id:** `typing.Optional[str]` — Unique identifier for a CMS Locale. This UID is different from the Site locale identifier and is listed as `cmsLocaleId` in the Sites response. To query multiple locales, input a comma separated string.
@@ -5922,7 +6562,7 @@ client.products.list(
-
client.products.create(...) +
client.collections.items.update_item(...)
@@ -5934,15 +6574,9 @@ client.products.list(
-Creating a new Product involves creating both a Product and a SKU, since a Product Item has to have, at minimum, a single SKU. - -In order to create a Product with multiple SKUs - for example a T-shirt in sizes small, medium and large - you'll need to create `sku-properties`. In our T-shirt example, a single `sku-property` would be Color. Within that property, we'll need to list out the various colors a T-shirt could be as an array of `enum` values: `royal-blue`, `crimson-red`, and `forrest-green`. - -Once, you've created a Product and its `sku-properties` with `enum` values, you can create your default SKU, which will automatically be a combination of the first `sku-properties` you've created. In our example, the default SKU will be a Royal Blue T-Shirt, because our first `enum` of our Color `sku-property` is Royal Blue. After you've created your product, you can create additional SKUs using the Create SKU endpoint - -Upon creation, the default product type will be `Advanced`. The product type is used to determine which Product and SKU fields are shown to users in the `Designer` and the `Editor`. Setting it to `Advanced` ensures that all Product and SKU fields will be shown. +Update a selected Item in a Collection. -Required scope | `ecommerce:write` +Required scope | `CMS:write`
@@ -5957,13 +6591,21 @@ Required scope | `ecommerce:write`
```python +from webflow import CollectionItemPatchSingleFieldData from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.products.create( - site_id="site_id", +client.collections.items.update_item( + collection_id="580e63fc8c9a982ac9b8b745", + item_id="580e64008c9a982ac9b8b754", + is_archived=False, + is_draft=False, + field_data=CollectionItemPatchSingleFieldData( + name="Pan Galactic Gargle Blaster Recipe", + slug="pan-galactic-gargle-blaster", + ), ) ``` @@ -5980,7 +6622,7 @@ client.products.create(
-**site_id:** `str` — Unique identifier for a Site +**collection_id:** `str` — Unique identifier for a Collection
@@ -5988,7 +6630,7 @@ client.products.create(
-**publish_status:** `typing.Optional[PublishStatus]` +**item_id:** `str` — Unique identifier for an Item
@@ -5996,7 +6638,7 @@ client.products.create(
-**product:** `typing.Optional[Product]` +**id:** `typing.Optional[str]` — Unique identifier for the Item
@@ -6004,7 +6646,7 @@ client.products.create(
-**sku:** `typing.Optional[Sku]` +**cms_locale_id:** `typing.Optional[str]` — Identifier for the locale of the CMS item
@@ -6012,72 +6654,39 @@ client.products.create(
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. +**last_published:** `typing.Optional[str]` — The date the item was last published
-
-
- - - - -
-
client.products.get(...)
-#### 📝 Description - -
-
+**last_updated:** `typing.Optional[str]` — The date the item was last updated + +
+
-Retrieve a single product by its id. All of its SKUs will also be retrieved. - -Required scope | `ecommerce:read` -
-
+**created_on:** `typing.Optional[str]` — The date the item was created +
-#### 🔌 Usage - -
-
-
-```python -from webflow.client import Webflow - -client = Webflow( - access_token="YOUR_ACCESS_TOKEN", -) -client.products.get( - site_id="site_id", - product_id="product_id", -) - -``` -
-
+**is_archived:** `typing.Optional[bool]` — Boolean determining if the Item is set to archived +
-#### ⚙️ Parameters -
-
-
- -**site_id:** `str` — Unique identifier for a Site +**is_draft:** `typing.Optional[bool]` — Boolean determining if the Item is set to draft
@@ -6085,7 +6694,7 @@ client.products.get(
-**product_id:** `str` — Unique identifier for a Product +**field_data:** `typing.Optional[CollectionItemPatchSingleFieldData]`
@@ -6105,7 +6714,7 @@ client.products.get(
-
client.products.update(...) +
client.collections.items.get_item_live(...)
@@ -6117,9 +6726,9 @@ client.products.get(
-Updating an existing Product will set the product type to `Advanced`. The product type is used to determine which Product and SKU fields are shown to users in the `Designer` and the `Editor`. Setting it to `Advanced` ensures that all Product and SKU fields will be shown. The product type can be edited in the `Designer` or the `Editor`. +Get details of a selected Collection live Item. -Required scope | `ecommerce:write` +Required scope | `CMS:read`
@@ -6139,9 +6748,9 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.products.update( - site_id="site_id", - product_id="product_id", +client.collections.items.get_item_live( + collection_id="580e63fc8c9a982ac9b8b745", + item_id="580e64008c9a982ac9b8b754", ) ``` @@ -6158,23 +6767,7 @@ client.products.update(
-**site_id:** `str` — Unique identifier for a Site - -
-
- -
-
- -**product_id:** `str` — Unique identifier for a Product - -
-
- -
-
- -**publish_status:** `typing.Optional[PublishStatus]` +**collection_id:** `str` — Unique identifier for a Collection
@@ -6182,7 +6775,7 @@ client.products.update(
-**product:** `typing.Optional[Product]` +**item_id:** `str` — Unique identifier for an Item
@@ -6190,7 +6783,7 @@ client.products.update(
-**sku:** `typing.Optional[Sku]` +**cms_locale_id:** `typing.Optional[str]` — Unique identifier for a CMS Locale. This UID is different from the Site locale identifier and is listed as `cmsLocaleId` in the Sites response. To query multiple locales, input a comma separated string.
@@ -6210,7 +6803,7 @@ client.products.update(
-
client.products.create_sku(...) +
client.collections.items.delete_item_live(...)
@@ -6222,11 +6815,11 @@ client.products.update(
-Create additional SKUs to cover every variant of your Product. The Default SKU already counts as one of the variants. +Remove a live item from the site. Removing a published item will unpublish the item from the live site and set it to draft. -Creating additional SKUs will set the product type to `Advanced` for the product associated with the SKUs. The product type is used to determine which Product and SKU fields are shown to users in the `Designer` and the `Editor`. Setting it to `Advanced` ensures that all Product and SKU fields will be shown. The product type can be edited in the `Designer` or the `Editor`. +This endpoint does not currently support bulk deletion. -Required scope | `ecommerce:write` +Required scope | `CMS:write`
@@ -6241,16 +6834,14 @@ Required scope | `ecommerce:write`
```python -from webflow import Sku from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.products.create_sku( - site_id="site_id", - product_id="product_id", - skus=[Sku()], +client.collections.items.delete_item_live( + collection_id="580e63fc8c9a982ac9b8b745", + item_id="580e64008c9a982ac9b8b754", ) ``` @@ -6267,15 +6858,7 @@ client.products.create_sku(
-**site_id:** `str` — Unique identifier for a Site - -
-
- -
-
- -**product_id:** `str` — Unique identifier for a Product +**collection_id:** `str` — Unique identifier for a Collection
@@ -6283,7 +6866,7 @@ client.products.create_sku(
-**skus:** `typing.Sequence[Sku]` — An array of the SKU data your are adding +**item_id:** `str` — Unique identifier for an Item
@@ -6291,7 +6874,7 @@ client.products.create_sku(
-**publish_status:** `typing.Optional[PublishStatus]` +**cms_locale_id:** `typing.Optional[str]` — Unique identifier for a CMS Locale. This UID is different from the Site locale identifier and is listed as `cmsLocaleId` in the Sites response. To query multiple locales, input a comma separated string.
@@ -6311,7 +6894,7 @@ client.products.create_sku(
-
client.products.update_sku(...) +
client.collections.items.update_item_live(...)
@@ -6323,9 +6906,9 @@ client.products.create_sku(
-Updating an existing SKU will set the product type to `Advanced` for the product associated with the SKU. The product type is used to determine which Product and SKU fields are shown to users in the `Designer` and the `Editor`. Setting it to `Advanced` ensures that all Product and SKU fields will be shown. The product type can be edited in the `Designer` or the `Editor`. +Update a selected live Item in a Collection. The updates for this Item will be published to the live site. -Required scope | `ecommerce:write` +Required scope | `CMS:write`
@@ -6340,17 +6923,21 @@ Required scope | `ecommerce:write`
```python -from webflow import Sku +from webflow import CollectionItemPatchSingleFieldData from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.products.update_sku( - site_id="site_id", - product_id="product_id", - sku_id="sku_id", - sku=Sku(), +client.collections.items.update_item_live( + collection_id="580e63fc8c9a982ac9b8b745", + item_id="580e64008c9a982ac9b8b754", + is_archived=False, + is_draft=False, + field_data=CollectionItemPatchSingleFieldData( + name="Pan Galactic Gargle Blaster Recipe", + slug="pan-galactic-gargle-blaster", + ), ) ``` @@ -6367,7 +6954,7 @@ client.products.update_sku(
-**site_id:** `str` — Unique identifier for a Site +**collection_id:** `str` — Unique identifier for a Collection
@@ -6375,7 +6962,7 @@ client.products.update_sku(
-**product_id:** `str` — Unique identifier for a Product +**item_id:** `str` — Unique identifier for an Item
@@ -6383,7 +6970,7 @@ client.products.update_sku(
-**sku_id:** `str` — Unique identifier for a SKU +**id:** `typing.Optional[str]` — Unique identifier for the Item
@@ -6391,7 +6978,7 @@ client.products.update_sku(
-**sku:** `Sku` +**cms_locale_id:** `typing.Optional[str]` — Identifier for the locale of the CMS item
@@ -6399,7 +6986,7 @@ client.products.update_sku(
-**publish_status:** `typing.Optional[PublishStatus]` +**last_published:** `typing.Optional[str]` — The date the item was last published
@@ -6407,64 +6994,79 @@ client.products.update_sku(
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. +**last_updated:** `typing.Optional[str]` — The date the item was last updated
+ +
+
+ +**created_on:** `typing.Optional[str]` — The date the item was created +
+
+
+**is_archived:** `typing.Optional[bool]` — Boolean determining if the Item is set to archived +
-
-## Orders -
client.orders.list(...)
-#### 📝 Description +**is_draft:** `typing.Optional[bool]` — Boolean determining if the Item is set to draft + +
+
+**field_data:** `typing.Optional[CollectionItemPatchSingleFieldData]` + +
+
+
-List all orders created for a given site. - -Required scope | `ecommerce:read` +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. +
-#### 🔌 Usage + + +
+ +
client.collections.items.publish_item(...)
+#### 📝 Description +
-```python -from webflow.client import Webflow +
+
-client = Webflow( - access_token="YOUR_ACCESS_TOKEN", -) -client.orders.list( - site_id="site_id", -) +Publish an item or multiple items. -``` +Required scope | `cms:write`
-#### ⚙️ Parameters +#### 🔌 Usage
@@ -6472,23 +7074,32 @@ client.orders.list(
-**site_id:** `str` — Unique identifier for a Site - +```python +from webflow.client import Webflow + +client = Webflow( + access_token="YOUR_ACCESS_TOKEN", +) +client.collections.items.publish_item( + collection_id="580e63fc8c9a982ac9b8b745", + item_ids=["itemIds"], +) + +``` +
+
+#### ⚙️ Parameters +
-**status:** `typing.Optional[OrdersListRequestStatus]` — Filter the orders by status - -
-
-
-**offset:** `typing.Optional[float]` — Offset used for pagination if the results have more than limit records +**collection_id:** `str` — Unique identifier for a Collection
@@ -6496,7 +7107,7 @@ client.orders.list(
-**limit:** `typing.Optional[float]` — Maximum number of records to be returned (max limit: 100) +**item_ids:** `typing.Sequence[str]`
@@ -6516,7 +7127,8 @@ client.orders.list(
-
client.orders.get(...) +## Pages Scripts +
client.pages.scripts.get_custom_code(...)
@@ -6528,9 +7140,15 @@ client.orders.list(
-Retrieve a single product by its id. All of its SKUs will also be retrieved. +Get all registered scripts that have been applied to a specific Page. -Required scope | `ecommerce:read` +In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered +to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate +`custom_code` endpoints. + +
Access to this endpoint requires a bearer token from a Data Client App.
+ +Required scope | `custom_code:read`
@@ -6550,9 +7168,8 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.orders.get( - site_id="site_id", - order_id="order_id", +client.pages.scripts.get_custom_code( + page_id="63c720f9347c2139b248e552", ) ``` @@ -6569,15 +7186,7 @@ client.orders.get(
-**site_id:** `str` — Unique identifier for a Site - -
-
- -
-
- -**order_id:** `str` — Unique identifier for an Order +**page_id:** `str` — Unique identifier for a Page
@@ -6597,7 +7206,7 @@ client.orders.get(
-
client.orders.update(...) +
client.pages.scripts.upsert_custom_code(...)
@@ -6609,9 +7218,15 @@ client.orders.get(
-This API lets you update the fields, `comment`, `shippingProvider`, and/or `shippingTracking` for a given order. All three fields can be updated simultaneously or independently. +Add a registered script to a Page. -Required scope | `ecommerce:write` +In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered +to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate +`custom_code` endpoints. + +
Access to this endpoint requires a bearer token from a Data Client App.
+ +Required scope | `custom_code:write`
@@ -6626,14 +7241,27 @@ Required scope | `ecommerce:write`
```python +from webflow import ScriptApply, ScriptApplyLocation from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.orders.update( - site_id="site_id", - order_id="order_id", +client.pages.scripts.upsert_custom_code( + page_id="63c720f9347c2139b248e552", + scripts=[ + ScriptApply( + id="cms_slider", + location=ScriptApplyLocation.HEADER, + version="1.0.0", + attributes={"my-attribute": "some-value"}, + ), + ScriptApply( + id="alert", + location=ScriptApplyLocation.HEADER, + version="0.0.1", + ), + ], ) ``` @@ -6650,23 +7278,7 @@ client.orders.update(
-**site_id:** `str` — Unique identifier for a Site - -
-
- -
-
- -**order_id:** `str` — Unique identifier for an Order - -
-
- -
-
- -**comment:** `typing.Optional[str]` — Arbitrary data for your records +**page_id:** `str` — Unique identifier for a Page
@@ -6674,7 +7286,7 @@ client.orders.update(
-**shipping_provider:** `typing.Optional[str]` — Company or method used to ship order +**scripts:** `typing.Optional[typing.Sequence[ScriptApply]]` — A list of scripts applied to a Site or a Page
@@ -6682,7 +7294,7 @@ client.orders.update(
-**shipping_tracking:** `typing.Optional[str]` — Tracking number for order shipment +**last_updated:** `typing.Optional[str]` — Date when the Site's scripts were last updated
@@ -6690,7 +7302,7 @@ client.orders.update(
-**shipping_tracking_url:** `typing.Optional[str]` — URL to track order shipment +**created_on:** `typing.Optional[str]` — Date when the Site's scripts were created
@@ -6710,7 +7322,7 @@ client.orders.update(
-
client.orders.update_fulfill(...) +
client.pages.scripts.delete_custom_code(...)
@@ -6722,9 +7334,15 @@ client.orders.update(
-Updates an order's status to fulfilled +Delete the custom code block that an app has created for a page -Required scope | `ecommerce:write` +In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered +to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate +`custom_code` endpoints. + +
Access to this endpoint requires a bearer token from a Data Client App.
+ +Required scope | `custom_code:write`
@@ -6744,9 +7362,8 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.orders.update_fulfill( - site_id="site_id", - order_id="order_id", +client.pages.scripts.delete_custom_code( + page_id="63c720f9347c2139b248e552", ) ``` @@ -6763,23 +7380,7 @@ client.orders.update_fulfill(
-**site_id:** `str` — Unique identifier for a Site - -
-
- -
-
- -**order_id:** `str` — Unique identifier for an Order - -
-
- -
-
- -**send_order_fulfilled_email:** `typing.Optional[bool]` — Whether or not the Order Fulfilled email should be sent +**page_id:** `str` — Unique identifier for a Page
@@ -6799,7 +7400,8 @@ client.orders.update_fulfill(
-
client.orders.update_unfulfill(...) +## Sites ActivityLogs +
client.sites.activity_logs.list(...)
@@ -6811,9 +7413,7 @@ client.orders.update_fulfill(
-Updates an order's status to unfulfilled - -Required scope | `ecommerce:write` +Retrieve Activity Logs for a specific Site. Requires Site to be on an Enterprise plan.

Required scope | `site_activity:read`
@@ -6833,9 +7433,8 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.orders.update_unfulfill( - site_id="site_id", - order_id="order_id", +client.sites.activity_logs.list( + site_id="580e63e98c9a982ac9b8b741", ) ``` @@ -6860,7 +7459,15 @@ client.orders.update_unfulfill(
-**order_id:** `str` — Unique identifier for an Order +**limit:** `typing.Optional[float]` — Maximum number of records to be returned (max limit: 100) + +
+
+ +
+
+ +**offset:** `typing.Optional[float]` — Offset used for pagination if the results have more than limit records
@@ -6880,7 +7487,8 @@ client.orders.update_unfulfill(
-
client.orders.refund(...) +## Sites Scripts +
client.sites.scripts.get_custom_code(...)
@@ -6892,10 +7500,11 @@ client.orders.update_unfulfill(
-This API will reverse a Stripe charge and refund an order back to a -customer. It will also set the order's status to `refunded`. +Get all registered scripts that have been applied to a specific Site. -Required scope | `ecommerce:write` +
Access to this endpoint requires a bearer token from a Data Client App.
+ +Required scope | `custom_code:read`
@@ -6915,9 +7524,8 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.orders.refund( - site_id="site_id", - order_id="order_id", +client.sites.scripts.get_custom_code( + site_id="580e63e98c9a982ac9b8b741", ) ``` @@ -6942,22 +7550,6 @@ client.orders.refund(
-**order_id:** `str` — Unique identifier for an Order - -
-
- -
-
- -**reason:** `typing.Optional[OrdersRefundRequestReason]` — The reason for the refund - -
-
- -
-
- **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -6970,8 +7562,7 @@ client.orders.refund(
-## Inventory -
client.inventory.list(...) +
client.sites.scripts.upsert_custom_code(...)
@@ -6983,9 +7574,15 @@ client.orders.refund(
-List the current inventory levels for a particular SKU item. +Add a registered script to a Site. -Required scope | `ecommerce:read` +In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered +to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate +`custom_code` endpoints. + +
Access to this endpoint requires a bearer token from a Data Client App.
+ +Required scope | `custom_code:write`
@@ -7000,14 +7597,27 @@ Required scope | `ecommerce:read`
```python +from webflow import ScriptApply, ScriptApplyLocation from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.inventory.list( - collection_id="collection_id", - item_id="item_id", +client.sites.scripts.upsert_custom_code( + site_id="580e63e98c9a982ac9b8b741", + scripts=[ + ScriptApply( + id="cms_slider", + location=ScriptApplyLocation.HEADER, + version="1.0.0", + attributes={"my-attribute": "some-value"}, + ), + ScriptApply( + id="alert", + location=ScriptApplyLocation.HEADER, + version="0.0.1", + ), + ], ) ``` @@ -7024,7 +7634,7 @@ client.inventory.list(
-**collection_id:** `str` — Unique identifier for a Collection +**site_id:** `str` — Unique identifier for a Site
@@ -7032,7 +7642,23 @@ client.inventory.list(
-**item_id:** `str` — Unique identifier for an Item +**scripts:** `typing.Optional[typing.Sequence[ScriptApply]]` — A list of scripts applied to a Site or a Page + +
+
+ +
+
+ +**last_updated:** `typing.Optional[str]` — Date when the Site's scripts were last updated + +
+
+ +
+
+ +**created_on:** `typing.Optional[str]` — Date when the Site's scripts were created
@@ -7052,7 +7678,7 @@ client.inventory.list(
-
client.inventory.update(...) +
client.sites.scripts.delete_custom_code(...)
@@ -7064,9 +7690,11 @@ client.inventory.list(
-Updates the current inventory levels for a particular SKU item. Updates may be given in one or two methods, absolutely or incrementally. Absolute updates are done by setting `quantity` directly. Incremental updates are by specifying the inventory delta in `updateQuantity` which is then added to the `quantity` stored on the server. +Delete the custom code block that an app created for a Site -Required scope | `ecommerce:write` +
Access to this endpoint requires a bearer token from a Data Client App.
+ +Required scope | `custom_code:write`
@@ -7081,16 +7709,13 @@ Required scope | `ecommerce:write`
```python -from webflow import InventoryUpdateRequestInventoryType from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.inventory.update( - collection_id="collection_id", - item_id="item_id", - inventory_type=InventoryUpdateRequestInventoryType.INFINITE, +client.sites.scripts.delete_custom_code( + site_id="580e63e98c9a982ac9b8b741", ) ``` @@ -7107,39 +7732,7 @@ client.inventory.update(
-**collection_id:** `str` — Unique identifier for a Collection - -
-
- -
-
- -**item_id:** `str` — Unique identifier for an Item - -
-
- -
-
- -**inventory_type:** `InventoryUpdateRequestInventoryType` — infinite or finite - -
-
- -
-
- -**update_quantity:** `typing.Optional[float]` — Adds this quantity to currently store quantity. Can be negative. - -
-
- -
-
- -**quantity:** `typing.Optional[float]` — Immediately sets quantity to this value. +**site_id:** `str` — Unique identifier for a Site
@@ -7159,8 +7752,7 @@ client.inventory.update(
-## Ecommerce -
client.ecommerce.get_settings(...) +
client.sites.scripts.list_custom_code_blocks(...)
@@ -7172,9 +7764,11 @@ client.inventory.update(
-Retrieve ecommerce settings for a site. +Get all instances of Custom Code applied to a Site or Pages. -Required scope | `ecommerce:read` +
Access to this endpoint requires a bearer token from a Data Client App.
+ +Required scope | `custom_code:read`
@@ -7194,8 +7788,8 @@ from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) -client.ecommerce.get_settings( - site_id="site_id", +client.sites.scripts.list_custom_code_blocks( + site_id="580e63e98c9a982ac9b8b741", ) ``` @@ -7220,6 +7814,22 @@ client.ecommerce.get_settings(
+**offset:** `typing.Optional[float]` — Offset used for pagination if the results have more than limit records + +
+
+ +
+
+ +**limit:** `typing.Optional[float]` — Maximum number of records to be returned (max limit: 100) + +
+
+ +
+
+ **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
diff --git a/src/webflow/__init__.py b/src/webflow/__init__.py index 45e46b7..6a10fed 100644 --- a/src/webflow/__init__.py +++ b/src/webflow/__init__.py @@ -16,11 +16,20 @@ AuthorizationAuthorizationAuthorizedTo, AuthorizedUser, BadRequestErrorBody, + BulkCollectionItem, + BulkCollectionItemFieldData, Collection, CollectionItem, CollectionItemFieldData, CollectionItemList, + CollectionItemListNoPagination, CollectionItemListPagination, + CollectionItemPatchSingle, + CollectionItemPatchSingleFieldData, + CollectionItemPostSingle, + CollectionItemPostSingleFieldData, + CollectionItemWithIdInput, + CollectionItemWithIdInputFieldData, CollectionList, CollectionListArrayItem, ConflictErrorBody, @@ -34,6 +43,7 @@ DuplicateUserEmail, EcommerceSettings, Error, + ErrorCode, ErrorDetailsItem, Field, FieldType, @@ -48,17 +58,16 @@ FormSubmissionList, ImageNode, InvalidDomain, + InvalidScopes, InventoryItem, InventoryItemInventoryType, ListCustomCodeBlocks, Locale, Locales, - MissingScopes, NoDomains, Node, NodeType, NotEnterprisePlanSite, - OauthScope, Order, OrderAddress, OrderAddressJapanType, @@ -78,9 +87,6 @@ OrderTotalsExtrasItem, OrderTotalsExtrasItemType, Page, - PageDetails, - PageDetailsOpenGraph, - PageDetailsSeo, PageList, PageOpenGraph, PageSeo, @@ -100,9 +106,11 @@ Scripts, Site, SiteActivityLogItem, + SiteActivityLogItemEvent, SiteActivityLogItemResourceOperation, SiteActivityLogItemUser, SiteActivityLogResponse, + SiteDataCollectionType, Sites, Sku, SkuFieldData, @@ -132,6 +140,7 @@ UserStatus, UsersNotEnabled, Webhook, + WebhookFilter, WebhookList, ) from .errors import ( @@ -150,6 +159,7 @@ OrdersListRequestStatus, OrdersRefundRequestReason, ProductsCreateSkuResponse, + SitesPublishResponse, UpdateStaticContentResponse, UsersListRequestSort, UsersUpdateRequestData, @@ -189,11 +199,20 @@ "AuthorizedUser", "BadRequestError", "BadRequestErrorBody", + "BulkCollectionItem", + "BulkCollectionItemFieldData", "Collection", "CollectionItem", "CollectionItemFieldData", "CollectionItemList", + "CollectionItemListNoPagination", "CollectionItemListPagination", + "CollectionItemPatchSingle", + "CollectionItemPatchSingleFieldData", + "CollectionItemPostSingle", + "CollectionItemPostSingleFieldData", + "CollectionItemWithIdInput", + "CollectionItemWithIdInputFieldData", "CollectionList", "CollectionListArrayItem", "ConflictError", @@ -209,6 +228,7 @@ "DuplicateUserEmail", "EcommerceSettings", "Error", + "ErrorCode", "ErrorDetailsItem", "Field", "FieldType", @@ -225,19 +245,18 @@ "ImageNode", "InternalServerError", "InvalidDomain", + "InvalidScopes", "InventoryItem", "InventoryItemInventoryType", "InventoryUpdateRequestInventoryType", "ListCustomCodeBlocks", "Locale", "Locales", - "MissingScopes", "NoDomains", "Node", "NodeType", "NotEnterprisePlanSite", "NotFoundError", - "OauthScope", "Order", "OrderAddress", "OrderAddressJapanType", @@ -259,9 +278,6 @@ "OrdersListRequestStatus", "OrdersRefundRequestReason", "Page", - "PageDetails", - "PageDetailsOpenGraph", - "PageDetailsSeo", "PageList", "PageOpenGraph", "PageSeo", @@ -282,10 +298,13 @@ "Scripts", "Site", "SiteActivityLogItem", + "SiteActivityLogItemEvent", "SiteActivityLogItemResourceOperation", "SiteActivityLogItemUser", "SiteActivityLogResponse", + "SiteDataCollectionType", "Sites", + "SitesPublishResponse", "Sku", "SkuFieldData", "SkuFieldDataCompareAtPrice", @@ -320,6 +339,7 @@ "UsersUpdateRequestData", "WebflowEnvironment", "Webhook", + "WebhookFilter", "WebhookList", "__version__", "access_groups", diff --git a/src/webflow/core/client_wrapper.py b/src/webflow/core/client_wrapper.py index f8b1535..b79d36a 100644 --- a/src/webflow/core/client_wrapper.py +++ b/src/webflow/core/client_wrapper.py @@ -23,7 +23,7 @@ def get_headers(self) -> typing.Dict[str, str]: headers: typing.Dict[str, str] = { "X-Fern-Language": "Python", "X-Fern-SDK-Name": "webflow", - "X-Fern-SDK-Version": "1.2.2", + "X-Fern-SDK-Version": "1.2.1", } headers["Authorization"] = f"Bearer {self._get_access_token()}" return headers diff --git a/src/webflow/errors/internal_server_error.py b/src/webflow/errors/internal_server_error.py index c2764d6..c5dcb4a 100644 --- a/src/webflow/errors/internal_server_error.py +++ b/src/webflow/errors/internal_server_error.py @@ -1,10 +1,9 @@ # This file was auto-generated by Fern from our API Definition. -import typing - from ..core.api_error import ApiError +from ..types.error import Error class InternalServerError(ApiError): - def __init__(self, body: typing.Any): + def __init__(self, body: Error): super().__init__(status_code=500, body=body) diff --git a/src/webflow/errors/not_found_error.py b/src/webflow/errors/not_found_error.py index 4405a19..307aa67 100644 --- a/src/webflow/errors/not_found_error.py +++ b/src/webflow/errors/not_found_error.py @@ -1,10 +1,9 @@ # This file was auto-generated by Fern from our API Definition. -import typing - from ..core.api_error import ApiError +from ..types.error import Error class NotFoundError(ApiError): - def __init__(self, body: typing.Any): + def __init__(self, body: Error): super().__init__(status_code=404, body=body) diff --git a/src/webflow/errors/too_many_requests_error.py b/src/webflow/errors/too_many_requests_error.py index 3bbbb0d..c2b3b10 100644 --- a/src/webflow/errors/too_many_requests_error.py +++ b/src/webflow/errors/too_many_requests_error.py @@ -1,10 +1,9 @@ # This file was auto-generated by Fern from our API Definition. -import typing - from ..core.api_error import ApiError +from ..types.error import Error class TooManyRequestsError(ApiError): - def __init__(self, body: typing.Any): + def __init__(self, body: Error): super().__init__(status_code=429, body=body) diff --git a/src/webflow/errors/unauthorized_error.py b/src/webflow/errors/unauthorized_error.py index e5c83f6..bba82e4 100644 --- a/src/webflow/errors/unauthorized_error.py +++ b/src/webflow/errors/unauthorized_error.py @@ -1,10 +1,9 @@ # This file was auto-generated by Fern from our API Definition. -import typing - from ..core.api_error import ApiError +from ..types.error import Error class UnauthorizedError(ApiError): - def __init__(self, body: typing.Any): + def __init__(self, body: Error): super().__init__(status_code=401, body=body) diff --git a/src/webflow/resources/__init__.py b/src/webflow/resources/__init__.py index 91d1d63..dcd56e9 100644 --- a/src/webflow/resources/__init__.py +++ b/src/webflow/resources/__init__.py @@ -21,6 +21,7 @@ from .orders import OrdersListRequestStatus, OrdersRefundRequestReason from .pages import DomWriteNodesItem, UpdateStaticContentResponse from .products import ProductsCreateSkuResponse +from .sites import SitesPublishResponse from .users import UsersListRequestSort, UsersUpdateRequestData __all__ = [ @@ -30,6 +31,7 @@ "OrdersListRequestStatus", "OrdersRefundRequestReason", "ProductsCreateSkuResponse", + "SitesPublishResponse", "UpdateStaticContentResponse", "UsersListRequestSort", "UsersUpdateRequestData", diff --git a/src/webflow/resources/access_groups/client.py b/src/webflow/resources/access_groups/client.py index 2f0e14f..673d264 100644 --- a/src/webflow/resources/access_groups/client.py +++ b/src/webflow/resources/access_groups/client.py @@ -15,6 +15,7 @@ from ...errors.too_many_requests_error import TooManyRequestsError from ...errors.unauthorized_error import UnauthorizedError from ...types.access_group_list import AccessGroupList +from ...types.error import Error from .types.access_groups_list_request_sort import AccessGroupsListRequestSort @@ -32,7 +33,9 @@ def list( request_options: typing.Optional[RequestOptions] = None, ) -> AccessGroupList: """ - Get a list of access groups for a site

Required scope | `users:read` + Get a list of access groups for a site + + Required scope | `users:read` Parameters ---------- @@ -65,7 +68,7 @@ def list( access_token="YOUR_ACCESS_TOKEN", ) client.access_groups.list( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = self._client_wrapper.httpx_client.request( @@ -80,15 +83,15 @@ def list( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -109,7 +112,9 @@ async def list( request_options: typing.Optional[RequestOptions] = None, ) -> AccessGroupList: """ - Get a list of access groups for a site

Required scope | `users:read` + Get a list of access groups for a site + + Required scope | `users:read` Parameters ---------- @@ -142,7 +147,7 @@ async def list( access_token="YOUR_ACCESS_TOKEN", ) await client.access_groups.list( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -157,15 +162,15 @@ async def list( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) diff --git a/src/webflow/resources/assets/client.py b/src/webflow/resources/assets/client.py index 131d573..fb15022 100644 --- a/src/webflow/resources/assets/client.py +++ b/src/webflow/resources/assets/client.py @@ -18,6 +18,7 @@ from ...types.asset_folder_list import AssetFolderList from ...types.asset_upload import AssetUpload from ...types.assets import Assets +from ...types.error import Error # this is used as the default value for optional parameters OMIT = typing.cast(typing.Any, ...) @@ -29,7 +30,9 @@ def __init__(self, *, client_wrapper: SyncClientWrapper): def list(self, site_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Assets: """ - List assets for a given site

Required scope | `assets:read` + List assets for a given site + + Required scope | `assets:read` Parameters ---------- @@ -52,7 +55,7 @@ def list(self, site_id: str, *, request_options: typing.Optional[RequestOptions] access_token="YOUR_ACCESS_TOKEN", ) client.assets.list( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = self._client_wrapper.httpx_client.request( @@ -64,13 +67,13 @@ def list(self, site_id: str, *, request_options: typing.Optional[RequestOptions] if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -86,7 +89,13 @@ def create( request_options: typing.Optional[RequestOptions] = None, ) -> AssetUpload: """ - Create a new asset entry.

This endpoint generates a response with the following information: `uploadUrl` and `uploadDetails`. You can use these two properties to [upload the file to Amazon s3 by making a POST](https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPOST.html) request to the `uploadUrl` with the `uploadDetails` object as your header information in the request.

Required scope | `assets:write` + Create a new asset entry. + + This endpoint generates a response with the following information: `uploadUrl` and `uploadDetails`. + You can use these two properties to [upload the file to Amazon s3 by making a POST](https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPOST.html) + request to the `uploadUrl` with the `uploadDetails` object as your header information in the request. + + Required scope | `assets:write` Parameters ---------- @@ -94,13 +103,13 @@ def create( Unique identifier for a Site file_name : str - file name including file extension + File name including file extension. File names must be less than 100 characters. file_hash : str MD5 hash of the file parent_folder : typing.Optional[str] - id of the Asset folder (optional) + ID of the Asset folder (optional) request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -118,7 +127,7 @@ def create( access_token="YOUR_ACCESS_TOKEN", ) client.assets.create( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", file_name="file.png", file_hash="3c7d87c9575702bc3b1e991f4d3c638e", ) @@ -136,13 +145,13 @@ def create( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -150,7 +159,9 @@ def create( def get(self, asset_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Asset: """ - Get an Asset

Required scope | `assets:read` + Get an Asset + + Required scope | `assets:read` Parameters ---------- @@ -173,7 +184,7 @@ def get(self, asset_id: str, *, request_options: typing.Optional[RequestOptions] access_token="YOUR_ACCESS_TOKEN", ) client.assets.get( - asset_id="asset_id", + asset_id="580e63fc8c9a982ac9b8b745", ) """ _response = self._client_wrapper.httpx_client.request( @@ -185,13 +196,13 @@ def get(self, asset_id: str, *, request_options: typing.Optional[RequestOptions] if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -201,6 +212,8 @@ def delete(self, asset_id: str, *, request_options: typing.Optional[RequestOptio """ Delete an Asset + Required Scope: `assets: write` + Parameters ---------- asset_id : str @@ -221,7 +234,7 @@ def delete(self, asset_id: str, *, request_options: typing.Optional[RequestOptio access_token="YOUR_ACCESS_TOKEN", ) client.assets.delete( - asset_id="asset_id", + asset_id="580e63fc8c9a982ac9b8b745", ) """ _response = self._client_wrapper.httpx_client.request( @@ -233,31 +246,41 @@ def delete(self, asset_id: str, *, request_options: typing.Optional[RequestOptio if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) def update( - self, asset_id: str, *, display_name: str, request_options: typing.Optional[RequestOptions] = None + self, + asset_id: str, + *, + locale_id: typing.Optional[str] = OMIT, + display_name: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, ) -> Asset: """ - Update an Asset

Required scope | `assets:write` + Update an Asset + + Required scope | `assets:write` Parameters ---------- asset_id : str Unique identifier for an Asset on a site - display_name : str - file name including file extension + locale_id : typing.Optional[str] + Unique identifier for a specific locale. Applicable, when using localization. + + display_name : typing.Optional[str] + A human readable name for the asset request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -275,14 +298,13 @@ def update( access_token="YOUR_ACCESS_TOKEN", ) client.assets.update( - asset_id="asset_id", - display_name="bulldoze.png", + asset_id="580e63fc8c9a982ac9b8b745", ) """ _response = self._client_wrapper.httpx_client.request( f"assets/{jsonable_encoder(asset_id)}", method="PATCH", - json={"displayName": display_name}, + json={"localeId": locale_id, "displayName": display_name}, request_options=request_options, omit=OMIT, ) @@ -292,13 +314,13 @@ def update( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -306,7 +328,9 @@ def update( def list_folders(self, site_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> AssetFolderList: """ - List Asset Folders within a given site

Required scope | `assets:read` + List Asset Folders within a given site + + Required scope | `assets:read` Parameters ---------- @@ -329,7 +353,7 @@ def list_folders(self, site_id: str, *, request_options: typing.Optional[Request access_token="YOUR_ACCESS_TOKEN", ) client.assets.list_folders( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = self._client_wrapper.httpx_client.request( @@ -341,13 +365,13 @@ def list_folders(self, site_id: str, *, request_options: typing.Optional[Request if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -362,7 +386,9 @@ def create_folder( request_options: typing.Optional[RequestOptions] = None, ) -> AssetFolder: """ - Create an Asset Folder within a given site

Required scope | `assets:write` + Create an Asset Folder within a given site + + Required scope | `assets:write` Parameters ---------- @@ -391,7 +417,7 @@ def create_folder( access_token="YOUR_ACCESS_TOKEN", ) client.assets.create_folder( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", display_name="my asset folder", ) """ @@ -408,13 +434,13 @@ def create_folder( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -424,7 +450,9 @@ def get_folder( self, asset_folder_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> AssetFolder: """ - Get details about a specific Asset Folder

Required scope | `assets:read` + Get details about a specific Asset Folder + + Required scope | `assets:read` Parameters ---------- @@ -447,7 +475,7 @@ def get_folder( access_token="YOUR_ACCESS_TOKEN", ) client.assets.get_folder( - asset_folder_id="asset_folder_id", + asset_folder_id="6390c49774a71f0e3c1a08ee", ) """ _response = self._client_wrapper.httpx_client.request( @@ -459,13 +487,13 @@ def get_folder( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -478,7 +506,9 @@ def __init__(self, *, client_wrapper: AsyncClientWrapper): async def list(self, site_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Assets: """ - List assets for a given site

Required scope | `assets:read` + List assets for a given site + + Required scope | `assets:read` Parameters ---------- @@ -501,7 +531,7 @@ async def list(self, site_id: str, *, request_options: typing.Optional[RequestOp access_token="YOUR_ACCESS_TOKEN", ) await client.assets.list( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -513,13 +543,13 @@ async def list(self, site_id: str, *, request_options: typing.Optional[RequestOp if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -535,7 +565,13 @@ async def create( request_options: typing.Optional[RequestOptions] = None, ) -> AssetUpload: """ - Create a new asset entry.

This endpoint generates a response with the following information: `uploadUrl` and `uploadDetails`. You can use these two properties to [upload the file to Amazon s3 by making a POST](https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPOST.html) request to the `uploadUrl` with the `uploadDetails` object as your header information in the request.

Required scope | `assets:write` + Create a new asset entry. + + This endpoint generates a response with the following information: `uploadUrl` and `uploadDetails`. + You can use these two properties to [upload the file to Amazon s3 by making a POST](https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPOST.html) + request to the `uploadUrl` with the `uploadDetails` object as your header information in the request. + + Required scope | `assets:write` Parameters ---------- @@ -543,13 +579,13 @@ async def create( Unique identifier for a Site file_name : str - file name including file extension + File name including file extension. File names must be less than 100 characters. file_hash : str MD5 hash of the file parent_folder : typing.Optional[str] - id of the Asset folder (optional) + ID of the Asset folder (optional) request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -567,7 +603,7 @@ async def create( access_token="YOUR_ACCESS_TOKEN", ) await client.assets.create( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", file_name="file.png", file_hash="3c7d87c9575702bc3b1e991f4d3c638e", ) @@ -585,13 +621,13 @@ async def create( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -599,7 +635,9 @@ async def create( async def get(self, asset_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Asset: """ - Get an Asset

Required scope | `assets:read` + Get an Asset + + Required scope | `assets:read` Parameters ---------- @@ -622,7 +660,7 @@ async def get(self, asset_id: str, *, request_options: typing.Optional[RequestOp access_token="YOUR_ACCESS_TOKEN", ) await client.assets.get( - asset_id="asset_id", + asset_id="580e63fc8c9a982ac9b8b745", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -634,13 +672,13 @@ async def get(self, asset_id: str, *, request_options: typing.Optional[RequestOp if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -650,6 +688,8 @@ async def delete(self, asset_id: str, *, request_options: typing.Optional[Reques """ Delete an Asset + Required Scope: `assets: write` + Parameters ---------- asset_id : str @@ -670,7 +710,7 @@ async def delete(self, asset_id: str, *, request_options: typing.Optional[Reques access_token="YOUR_ACCESS_TOKEN", ) await client.assets.delete( - asset_id="asset_id", + asset_id="580e63fc8c9a982ac9b8b745", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -682,31 +722,41 @@ async def delete(self, asset_id: str, *, request_options: typing.Optional[Reques if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) async def update( - self, asset_id: str, *, display_name: str, request_options: typing.Optional[RequestOptions] = None + self, + asset_id: str, + *, + locale_id: typing.Optional[str] = OMIT, + display_name: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, ) -> Asset: """ - Update an Asset

Required scope | `assets:write` + Update an Asset + + Required scope | `assets:write` Parameters ---------- asset_id : str Unique identifier for an Asset on a site - display_name : str - file name including file extension + locale_id : typing.Optional[str] + Unique identifier for a specific locale. Applicable, when using localization. + + display_name : typing.Optional[str] + A human readable name for the asset request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -724,14 +774,13 @@ async def update( access_token="YOUR_ACCESS_TOKEN", ) await client.assets.update( - asset_id="asset_id", - display_name="bulldoze.png", + asset_id="580e63fc8c9a982ac9b8b745", ) """ _response = await self._client_wrapper.httpx_client.request( f"assets/{jsonable_encoder(asset_id)}", method="PATCH", - json={"displayName": display_name}, + json={"localeId": locale_id, "displayName": display_name}, request_options=request_options, omit=OMIT, ) @@ -741,13 +790,13 @@ async def update( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -757,7 +806,9 @@ async def list_folders( self, site_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> AssetFolderList: """ - List Asset Folders within a given site

Required scope | `assets:read` + List Asset Folders within a given site + + Required scope | `assets:read` Parameters ---------- @@ -780,7 +831,7 @@ async def list_folders( access_token="YOUR_ACCESS_TOKEN", ) await client.assets.list_folders( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -792,13 +843,13 @@ async def list_folders( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -813,7 +864,9 @@ async def create_folder( request_options: typing.Optional[RequestOptions] = None, ) -> AssetFolder: """ - Create an Asset Folder within a given site

Required scope | `assets:write` + Create an Asset Folder within a given site + + Required scope | `assets:write` Parameters ---------- @@ -842,7 +895,7 @@ async def create_folder( access_token="YOUR_ACCESS_TOKEN", ) await client.assets.create_folder( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", display_name="my asset folder", ) """ @@ -859,13 +912,13 @@ async def create_folder( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -875,7 +928,9 @@ async def get_folder( self, asset_folder_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> AssetFolder: """ - Get details about a specific Asset Folder

Required scope | `assets:read` + Get details about a specific Asset Folder + + Required scope | `assets:read` Parameters ---------- @@ -898,7 +953,7 @@ async def get_folder( access_token="YOUR_ACCESS_TOKEN", ) await client.assets.get_folder( - asset_folder_id="asset_folder_id", + asset_folder_id="6390c49774a71f0e3c1a08ee", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -910,13 +965,13 @@ async def get_folder( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) diff --git a/src/webflow/resources/collections/__init__.py b/src/webflow/resources/collections/__init__.py index a029bd0..cb6aaf8 100644 --- a/src/webflow/resources/collections/__init__.py +++ b/src/webflow/resources/collections/__init__.py @@ -1,23 +1,41 @@ # This file was auto-generated by Fern from our API Definition. from .resources import ( - BulkCollectionItemFieldData, + CreateBulkCollectionItemRequestBodyFieldData, + CreateBulkCollectionItemRequestBodyFieldDataItem, FieldCreateType, + ItemsCreateItemLiveRequest, + ItemsCreateItemRequest, + ItemsDeleteItemsLiveRequestItemsItem, + ItemsDeleteItemsRequestItemsItem, ItemsListItemsLiveRequestSortBy, ItemsListItemsLiveRequestSortOrder, ItemsListItemsRequestSortBy, ItemsListItemsRequestSortOrder, + ItemsPublishItemResponse, + MultipleItems, + MultipleLiveItems, + SingleCmsItem, fields, items, ) __all__ = [ - "BulkCollectionItemFieldData", + "CreateBulkCollectionItemRequestBodyFieldData", + "CreateBulkCollectionItemRequestBodyFieldDataItem", "FieldCreateType", + "ItemsCreateItemLiveRequest", + "ItemsCreateItemRequest", + "ItemsDeleteItemsLiveRequestItemsItem", + "ItemsDeleteItemsRequestItemsItem", "ItemsListItemsLiveRequestSortBy", "ItemsListItemsLiveRequestSortOrder", "ItemsListItemsRequestSortBy", "ItemsListItemsRequestSortOrder", + "ItemsPublishItemResponse", + "MultipleItems", + "MultipleLiveItems", + "SingleCmsItem", "fields", "items", ] diff --git a/src/webflow/resources/collections/client.py b/src/webflow/resources/collections/client.py index 1d1ba20..f68ca6a 100644 --- a/src/webflow/resources/collections/client.py +++ b/src/webflow/resources/collections/client.py @@ -15,6 +15,7 @@ from ...errors.unauthorized_error import UnauthorizedError from ...types.collection import Collection from ...types.collection_list import CollectionList +from ...types.error import Error from .resources.fields.client import AsyncFieldsClient, FieldsClient from .resources.items.client import AsyncItemsClient, ItemsClient @@ -30,7 +31,9 @@ def __init__(self, *, client_wrapper: SyncClientWrapper): def list(self, site_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> CollectionList: """ - List of all Collections within a Site.

Required scope | `cms:read` + List of all Collections within a Site. + + Required scope | `cms:read` Parameters ---------- @@ -53,7 +56,7 @@ def list(self, site_id: str, *, request_options: typing.Optional[RequestOptions] access_token="YOUR_ACCESS_TOKEN", ) client.collections.list( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = self._client_wrapper.httpx_client.request( @@ -65,13 +68,13 @@ def list(self, site_id: str, *, request_options: typing.Optional[RequestOptions] if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -87,7 +90,9 @@ def create( request_options: typing.Optional[RequestOptions] = None, ) -> Collection: """ - Create a Collection for a site.

Required scope | `cms:write` + Create a Collection for a site. + + Required scope | `cms:write` Parameters ---------- @@ -119,7 +124,7 @@ def create( access_token="YOUR_ACCESS_TOKEN", ) client.collections.create( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", display_name="Blog Posts", singular_name="Blog Post", slug="posts", @@ -138,13 +143,13 @@ def create( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -152,7 +157,9 @@ def create( def get(self, collection_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Collection: """ - Get the full details of a collection from its ID.

Required scope | `cms:read` + Get the full details of a collection from its ID. + + Required scope | `cms:read` Parameters ---------- @@ -175,7 +182,7 @@ def get(self, collection_id: str, *, request_options: typing.Optional[RequestOpt access_token="YOUR_ACCESS_TOKEN", ) client.collections.get( - collection_id="collection_id", + collection_id="580e63fc8c9a982ac9b8b745", ) """ _response = self._client_wrapper.httpx_client.request( @@ -187,80 +194,29 @@ def get(self, collection_id: str, *, request_options: typing.Optional[RequestOpt if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - def delete_collection(self, collection_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: + def delete(self, collection_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: """ - Delete a collection using its ID.

Required scope | `cms:write` - - Parameters - ---------- - collection_id : str - Unique identifier for a Collection + Delete a collection using its ID. - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - None - - Examples - -------- - from webflow.client import Webflow - - client = Webflow( - access_token="YOUR_ACCESS_TOKEN", - ) - client.collections.delete_collection( - collection_id="collection_id", - ) - """ - _response = self._client_wrapper.httpx_client.request( - f"collections/{jsonable_encoder(collection_id)}", method="DELETE", request_options=request_options - ) - try: - if 200 <= _response.status_code < 300: - return - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore - if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore - if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def delete( - self, collection_id: str, field_id: str, *, request_options: typing.Optional[RequestOptions] = None - ) -> None: - """ - Delete a custom field in a collection. This endpoint does not currently support bulk deletion.

Required scope | `cms:write` + Required scope | `cms:write` Parameters ---------- collection_id : str Unique identifier for a Collection - field_id : str - Unique identifier for a Field in a collection - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -276,14 +232,11 @@ def delete( access_token="YOUR_ACCESS_TOKEN", ) client.collections.delete( - collection_id="collection_id", - field_id="field_id", + collection_id="580e63fc8c9a982ac9b8b745", ) """ _response = self._client_wrapper.httpx_client.request( - f"collections/{jsonable_encoder(collection_id)}/fields/{jsonable_encoder(field_id)}", - method="DELETE", - request_options=request_options, + f"collections/{jsonable_encoder(collection_id)}", method="DELETE", request_options=request_options ) try: if 200 <= _response.status_code < 300: @@ -291,13 +244,13 @@ def delete( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -312,7 +265,9 @@ def __init__(self, *, client_wrapper: AsyncClientWrapper): async def list(self, site_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> CollectionList: """ - List of all Collections within a Site.

Required scope | `cms:read` + List of all Collections within a Site. + + Required scope | `cms:read` Parameters ---------- @@ -335,7 +290,7 @@ async def list(self, site_id: str, *, request_options: typing.Optional[RequestOp access_token="YOUR_ACCESS_TOKEN", ) await client.collections.list( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -347,13 +302,13 @@ async def list(self, site_id: str, *, request_options: typing.Optional[RequestOp if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -369,7 +324,9 @@ async def create( request_options: typing.Optional[RequestOptions] = None, ) -> Collection: """ - Create a Collection for a site.

Required scope | `cms:write` + Create a Collection for a site. + + Required scope | `cms:write` Parameters ---------- @@ -401,7 +358,7 @@ async def create( access_token="YOUR_ACCESS_TOKEN", ) await client.collections.create( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", display_name="Blog Posts", singular_name="Blog Post", slug="posts", @@ -420,13 +377,13 @@ async def create( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -434,7 +391,9 @@ async def create( async def get(self, collection_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Collection: """ - Get the full details of a collection from its ID.

Required scope | `cms:read` + Get the full details of a collection from its ID. + + Required scope | `cms:read` Parameters ---------- @@ -457,7 +416,7 @@ async def get(self, collection_id: str, *, request_options: typing.Optional[Requ access_token="YOUR_ACCESS_TOKEN", ) await client.collections.get( - collection_id="collection_id", + collection_id="580e63fc8c9a982ac9b8b745", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -469,82 +428,29 @@ async def get(self, collection_id: str, *, request_options: typing.Optional[Requ if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - async def delete_collection( - self, collection_id: str, *, request_options: typing.Optional[RequestOptions] = None - ) -> None: + async def delete(self, collection_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: """ - Delete a collection using its ID.

Required scope | `cms:write` - - Parameters - ---------- - collection_id : str - Unique identifier for a Collection + Delete a collection using its ID. - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - None - - Examples - -------- - from webflow.client import AsyncWebflow - - client = AsyncWebflow( - access_token="YOUR_ACCESS_TOKEN", - ) - await client.collections.delete_collection( - collection_id="collection_id", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - f"collections/{jsonable_encoder(collection_id)}", method="DELETE", request_options=request_options - ) - try: - if 200 <= _response.status_code < 300: - return - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore - if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore - if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def delete( - self, collection_id: str, field_id: str, *, request_options: typing.Optional[RequestOptions] = None - ) -> None: - """ - Delete a custom field in a collection. This endpoint does not currently support bulk deletion.

Required scope | `cms:write` + Required scope | `cms:write` Parameters ---------- collection_id : str Unique identifier for a Collection - field_id : str - Unique identifier for a Field in a collection - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -560,14 +466,11 @@ async def delete( access_token="YOUR_ACCESS_TOKEN", ) await client.collections.delete( - collection_id="collection_id", - field_id="field_id", + collection_id="580e63fc8c9a982ac9b8b745", ) """ _response = await self._client_wrapper.httpx_client.request( - f"collections/{jsonable_encoder(collection_id)}/fields/{jsonable_encoder(field_id)}", - method="DELETE", - request_options=request_options, + f"collections/{jsonable_encoder(collection_id)}", method="DELETE", request_options=request_options ) try: if 200 <= _response.status_code < 300: @@ -575,13 +478,13 @@ async def delete( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) diff --git a/src/webflow/resources/collections/resources/__init__.py b/src/webflow/resources/collections/resources/__init__.py index 2b2d370..f9325ee 100644 --- a/src/webflow/resources/collections/resources/__init__.py +++ b/src/webflow/resources/collections/resources/__init__.py @@ -3,20 +3,38 @@ from . import fields, items from .fields import FieldCreateType from .items import ( - BulkCollectionItemFieldData, + CreateBulkCollectionItemRequestBodyFieldData, + CreateBulkCollectionItemRequestBodyFieldDataItem, + ItemsCreateItemLiveRequest, + ItemsCreateItemRequest, + ItemsDeleteItemsLiveRequestItemsItem, + ItemsDeleteItemsRequestItemsItem, ItemsListItemsLiveRequestSortBy, ItemsListItemsLiveRequestSortOrder, ItemsListItemsRequestSortBy, ItemsListItemsRequestSortOrder, + ItemsPublishItemResponse, + MultipleItems, + MultipleLiveItems, + SingleCmsItem, ) __all__ = [ - "BulkCollectionItemFieldData", + "CreateBulkCollectionItemRequestBodyFieldData", + "CreateBulkCollectionItemRequestBodyFieldDataItem", "FieldCreateType", + "ItemsCreateItemLiveRequest", + "ItemsCreateItemRequest", + "ItemsDeleteItemsLiveRequestItemsItem", + "ItemsDeleteItemsRequestItemsItem", "ItemsListItemsLiveRequestSortBy", "ItemsListItemsLiveRequestSortOrder", "ItemsListItemsRequestSortBy", "ItemsListItemsRequestSortOrder", + "ItemsPublishItemResponse", + "MultipleItems", + "MultipleLiveItems", + "SingleCmsItem", "fields", "items", ] diff --git a/src/webflow/resources/collections/resources/fields/client.py b/src/webflow/resources/collections/resources/fields/client.py index 710092f..0cdd472 100644 --- a/src/webflow/resources/collections/resources/fields/client.py +++ b/src/webflow/resources/collections/resources/fields/client.py @@ -13,6 +13,7 @@ from .....errors.not_found_error import NotFoundError from .....errors.too_many_requests_error import TooManyRequestsError from .....errors.unauthorized_error import UnauthorizedError +from .....types.error import Error from .....types.field import Field from .types.field_create_type import FieldCreateType @@ -35,7 +36,16 @@ def create( request_options: typing.Optional[RequestOptions] = None, ) -> Field: """ - Create a custom field in a collection.

Slugs must be all lowercase letters without spaces. If you pass a string with uppercase letters and/or spaces to the "Slug" property, Webflow will convert the slug to lowercase and replace spaces with "-."

Only some field types can be created through the API. This endpoint does not currently support bulk creation.

Required scope | `cms:write` + Create a custom field in a collection. + + Slugs must be all lowercase letters without spaces. + If you pass a string with uppercase letters and/or spaces to the "Slug" property, Webflow will + convert the slug to lowercase and replace spaces with "-." + + Only some field types can be created through the API. + This endpoint does not currently support bulk creation. + + Required scope | `cms:write` Parameters ---------- @@ -71,7 +81,7 @@ def create( access_token="YOUR_ACCESS_TOKEN", ) client.collections.fields.create( - collection_id="collection_id", + collection_id="580e63fc8c9a982ac9b8b745", is_required=False, type=FieldCreateType.RICH_TEXT, display_name="Post Body", @@ -91,13 +101,71 @@ def create( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def delete( + self, collection_id: str, field_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> None: + """ + Delete a custom field in a collection. This endpoint does not currently support bulk deletion. + + Required scope | `cms:write` + + Parameters + ---------- + collection_id : str + Unique identifier for a Collection + + field_id : str + Unique identifier for a Field in a collection + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from webflow.client import Webflow + + client = Webflow( + access_token="YOUR_ACCESS_TOKEN", + ) + client.collections.fields.delete( + collection_id="580e63fc8c9a982ac9b8b745", + field_id="580e63fc8c9a982ac9b8b745", + ) + """ + _response = self._client_wrapper.httpx_client.request( + f"collections/{jsonable_encoder(collection_id)}/fields/{jsonable_encoder(field_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return + if _response.status_code == 400: + raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + if _response.status_code == 401: + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + if _response.status_code == 404: + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + if _response.status_code == 429: + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + if _response.status_code == 500: + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -114,7 +182,9 @@ def update( request_options: typing.Optional[RequestOptions] = None, ) -> Field: """ - Update a custom field in a collection.

Required scope | `cms:write` + Update a custom field in a collection. + + Required scope | `cms:write` Parameters ---------- @@ -149,8 +219,8 @@ def update( access_token="YOUR_ACCESS_TOKEN", ) client.collections.fields.update( - collection_id="collection_id", - field_id="field_id", + collection_id="580e63fc8c9a982ac9b8b745", + field_id="580e63fc8c9a982ac9b8b745", is_required=False, display_name="Post Body", help_text="Add the body of your post here", @@ -169,13 +239,13 @@ def update( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -197,7 +267,16 @@ async def create( request_options: typing.Optional[RequestOptions] = None, ) -> Field: """ - Create a custom field in a collection.

Slugs must be all lowercase letters without spaces. If you pass a string with uppercase letters and/or spaces to the "Slug" property, Webflow will convert the slug to lowercase and replace spaces with "-."

Only some field types can be created through the API. This endpoint does not currently support bulk creation.

Required scope | `cms:write` + Create a custom field in a collection. + + Slugs must be all lowercase letters without spaces. + If you pass a string with uppercase letters and/or spaces to the "Slug" property, Webflow will + convert the slug to lowercase and replace spaces with "-." + + Only some field types can be created through the API. + This endpoint does not currently support bulk creation. + + Required scope | `cms:write` Parameters ---------- @@ -233,7 +312,7 @@ async def create( access_token="YOUR_ACCESS_TOKEN", ) await client.collections.fields.create( - collection_id="collection_id", + collection_id="580e63fc8c9a982ac9b8b745", is_required=False, type=FieldCreateType.RICH_TEXT, display_name="Post Body", @@ -253,13 +332,71 @@ async def create( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def delete( + self, collection_id: str, field_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> None: + """ + Delete a custom field in a collection. This endpoint does not currently support bulk deletion. + + Required scope | `cms:write` + + Parameters + ---------- + collection_id : str + Unique identifier for a Collection + + field_id : str + Unique identifier for a Field in a collection + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from webflow.client import AsyncWebflow + + client = AsyncWebflow( + access_token="YOUR_ACCESS_TOKEN", + ) + await client.collections.fields.delete( + collection_id="580e63fc8c9a982ac9b8b745", + field_id="580e63fc8c9a982ac9b8b745", + ) + """ + _response = await self._client_wrapper.httpx_client.request( + f"collections/{jsonable_encoder(collection_id)}/fields/{jsonable_encoder(field_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return + if _response.status_code == 400: + raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + if _response.status_code == 401: + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + if _response.status_code == 404: + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + if _response.status_code == 429: + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + if _response.status_code == 500: + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -276,7 +413,9 @@ async def update( request_options: typing.Optional[RequestOptions] = None, ) -> Field: """ - Update a custom field in a collection.

Required scope | `cms:write` + Update a custom field in a collection. + + Required scope | `cms:write` Parameters ---------- @@ -311,8 +450,8 @@ async def update( access_token="YOUR_ACCESS_TOKEN", ) await client.collections.fields.update( - collection_id="collection_id", - field_id="field_id", + collection_id="580e63fc8c9a982ac9b8b745", + field_id="580e63fc8c9a982ac9b8b745", is_required=False, display_name="Post Body", help_text="Add the body of your post here", @@ -331,13 +470,13 @@ async def update( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) diff --git a/src/webflow/resources/collections/resources/items/__init__.py b/src/webflow/resources/collections/resources/items/__init__.py index c8549f0..fbccd1b 100644 --- a/src/webflow/resources/collections/resources/items/__init__.py +++ b/src/webflow/resources/collections/resources/items/__init__.py @@ -1,17 +1,35 @@ # This file was auto-generated by Fern from our API Definition. from .types import ( - BulkCollectionItemFieldData, + CreateBulkCollectionItemRequestBodyFieldData, + CreateBulkCollectionItemRequestBodyFieldDataItem, + ItemsCreateItemLiveRequest, + ItemsCreateItemRequest, + ItemsDeleteItemsLiveRequestItemsItem, + ItemsDeleteItemsRequestItemsItem, ItemsListItemsLiveRequestSortBy, ItemsListItemsLiveRequestSortOrder, ItemsListItemsRequestSortBy, ItemsListItemsRequestSortOrder, + ItemsPublishItemResponse, + MultipleItems, + MultipleLiveItems, + SingleCmsItem, ) __all__ = [ - "BulkCollectionItemFieldData", + "CreateBulkCollectionItemRequestBodyFieldData", + "CreateBulkCollectionItemRequestBodyFieldDataItem", + "ItemsCreateItemLiveRequest", + "ItemsCreateItemRequest", + "ItemsDeleteItemsLiveRequestItemsItem", + "ItemsDeleteItemsRequestItemsItem", "ItemsListItemsLiveRequestSortBy", "ItemsListItemsLiveRequestSortOrder", "ItemsListItemsRequestSortBy", "ItemsListItemsRequestSortOrder", + "ItemsPublishItemResponse", + "MultipleItems", + "MultipleLiveItems", + "SingleCmsItem", ] diff --git a/src/webflow/resources/collections/resources/items/client.py b/src/webflow/resources/collections/resources/items/client.py index 9a51804..04c4f38 100644 --- a/src/webflow/resources/collections/resources/items/client.py +++ b/src/webflow/resources/collections/resources/items/client.py @@ -9,18 +9,28 @@ from .....core.pydantic_utilities import pydantic_v1 from .....core.request_options import RequestOptions from .....errors.bad_request_error import BadRequestError +from .....errors.conflict_error import ConflictError from .....errors.internal_server_error import InternalServerError from .....errors.not_found_error import NotFoundError from .....errors.too_many_requests_error import TooManyRequestsError from .....errors.unauthorized_error import UnauthorizedError +from .....types.bulk_collection_item import BulkCollectionItem from .....types.collection_item import CollectionItem -from .....types.collection_item_field_data import CollectionItemFieldData from .....types.collection_item_list import CollectionItemList -from .types.bulk_collection_item_field_data import BulkCollectionItemFieldData +from .....types.collection_item_list_no_pagination import CollectionItemListNoPagination +from .....types.collection_item_patch_single_field_data import CollectionItemPatchSingleFieldData +from .....types.collection_item_with_id_input import CollectionItemWithIdInput +from .....types.error import Error +from .types.create_bulk_collection_item_request_body_field_data import CreateBulkCollectionItemRequestBodyFieldData +from .types.items_create_item_live_request import ItemsCreateItemLiveRequest +from .types.items_create_item_request import ItemsCreateItemRequest +from .types.items_delete_items_live_request_items_item import ItemsDeleteItemsLiveRequestItemsItem +from .types.items_delete_items_request_items_item import ItemsDeleteItemsRequestItemsItem from .types.items_list_items_live_request_sort_by import ItemsListItemsLiveRequestSortBy from .types.items_list_items_live_request_sort_order import ItemsListItemsLiveRequestSortOrder from .types.items_list_items_request_sort_by import ItemsListItemsRequestSortBy from .types.items_list_items_request_sort_order import ItemsListItemsRequestSortOrder +from .types.items_publish_item_response import ItemsPublishItemResponse # this is used as the default value for optional parameters OMIT = typing.cast(typing.Any, ...) @@ -44,7 +54,9 @@ def list_items( request_options: typing.Optional[RequestOptions] = None, ) -> CollectionItemList: """ - List of all Items within a Collection.

Required scope | `CMS:read` + List of all Items within a Collection. + + Required scope | `CMS:read` Parameters ---------- @@ -88,7 +100,7 @@ def list_items( access_token="YOUR_ACCESS_TOKEN", ) client.collections.items.list_items( - collection_id="collection_id", + collection_id="580e63fc8c9a982ac9b8b745", ) """ _response = self._client_wrapper.httpx_client.request( @@ -111,13 +123,13 @@ def list_items( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -127,46 +139,96 @@ def create_item( self, collection_id: str, *, - id: str, - cms_locale_id: typing.Optional[str] = OMIT, - last_published: typing.Optional[str] = OMIT, - last_updated: typing.Optional[str] = OMIT, - created_on: typing.Optional[str] = OMIT, - is_archived: typing.Optional[bool] = OMIT, - is_draft: typing.Optional[bool] = OMIT, - field_data: typing.Optional[CollectionItemFieldData] = OMIT, + request: ItemsCreateItemRequest, request_options: typing.Optional[RequestOptions] = None, - ) -> None: + ) -> CollectionItem: """ - Create Item in a Collection.

To create items across multiple locales, please use this endpoint.

Required scope | `CMS:write` + Create Item(s) in a Collection. + + To create items across multiple locales, please use [this endpoint.](/v2.0.0/data/reference/cms/collection-items/staged-items/create-items) + + Required scope | `CMS:write` Parameters ---------- collection_id : str Unique identifier for a Collection - id : str - Unique identifier for the Item + request : ItemsCreateItemRequest - cms_locale_id : typing.Optional[str] - Identifier for the locale of the CMS item + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - last_published : typing.Optional[str] - The date the item was last published + Returns + ------- + CollectionItem + Request was successful - last_updated : typing.Optional[str] - The date the item was last updated + Examples + -------- + from webflow import CollectionItemPostSingle, CollectionItemPostSingleFieldData + from webflow.client import Webflow - created_on : typing.Optional[str] - The date the item was created + client = Webflow( + access_token="YOUR_ACCESS_TOKEN", + ) + client.collections.items.create_item( + collection_id="580e63fc8c9a982ac9b8b745", + request=CollectionItemPostSingle( + is_archived=False, + is_draft=False, + field_data=CollectionItemPostSingleFieldData( + name="Pan Galactic Gargle Blaster Recipe", + slug="pan-galactic-gargle-blaster", + ), + ), + ) + """ + _response = self._client_wrapper.httpx_client.request( + f"collections/{jsonable_encoder(collection_id)}/items", + method="POST", + json=request, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return pydantic_v1.parse_obj_as(CollectionItem, _response.json()) # type: ignore + if _response.status_code == 400: + raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + if _response.status_code == 401: + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + if _response.status_code == 404: + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + if _response.status_code == 429: + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + if _response.status_code == 500: + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) - is_archived : typing.Optional[bool] - Boolean determining if the Item is set to archived + def delete_items( + self, + collection_id: str, + *, + items: typing.Optional[typing.Sequence[ItemsDeleteItemsRequestItemsItem]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Delete Items from a Collection. - is_draft : typing.Optional[bool] - Boolean determining if the Item is set to draft + **Note:** If the `cmsLocaleId` parameter is undefined or empty and the items are localized, items will be deleted only in the primary locale. - field_data : typing.Optional[CollectionItemFieldData] + Required scope | `CMS:write` + + Parameters + ---------- + collection_id : str + Unique identifier for a Collection + + items : typing.Optional[typing.Sequence[ItemsDeleteItemsRequestItemsItem]] request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -177,40 +239,19 @@ def create_item( Examples -------- - from webflow import CollectionItemFieldData from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) - client.collections.items.create_item( - collection_id="collection_id", - id="42b720ef280c7a7a3be8cabe", - cms_locale_id="653ad57de882f528b32e810e", - last_published="2022-11-29T16:22:43.159Z", - last_updated="2022-11-17T17:19:43.282Z", - created_on="2022-11-17T17:11:57.148Z", - is_archived=False, - is_draft=False, - field_data=CollectionItemFieldData( - name="Pan Galactic Gargle Blaster Recipe", - slug="pan-galactic-gargle-blaster", - ), + client.collections.items.delete_items( + collection_id="580e63fc8c9a982ac9b8b745", ) """ _response = self._client_wrapper.httpx_client.request( f"collections/{jsonable_encoder(collection_id)}/items", - method="POST", - json={ - "id": id, - "cmsLocaleId": cms_locale_id, - "lastPublished": last_published, - "lastUpdated": last_updated, - "createdOn": created_on, - "isArchived": is_archived, - "isDraft": is_draft, - "fieldData": field_data, - }, + method="DELETE", + json={"items": items}, request_options=request_options, omit=OMIT, ) @@ -220,13 +261,118 @@ def create_item( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + if _response.status_code == 404: + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + if _response.status_code == 409: + raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + if _response.status_code == 429: + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + if _response.status_code == 500: + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def update_items( + self, + collection_id: str, + *, + items: typing.Optional[typing.Sequence[CollectionItemWithIdInput]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> CollectionItem: + """ + Update a single item or multiple items (up to 100) in a Collection. + + **Note:** If the `cmsLocaleId` parameter is undefined or empty and the items are localized, items will be updated only in the primary locale. + + Required scope | `CMS:write` + + Parameters + ---------- + collection_id : str + Unique identifier for a Collection + + items : typing.Optional[typing.Sequence[CollectionItemWithIdInput]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CollectionItem + Request was successful + + Examples + -------- + from webflow import ( + CollectionItemWithIdInput, + CollectionItemWithIdInputFieldData, + ) + from webflow.client import Webflow + + client = Webflow( + access_token="YOUR_ACCESS_TOKEN", + ) + client.collections.items.update_items( + collection_id="580e63fc8c9a982ac9b8b745", + items=[ + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5ea6", + cms_locale_id="66f6e966c9e1dc700a857ca5", + field_data=CollectionItemWithIdInputFieldData( + name="Ne Paniquez Pas", + slug="ne-paniquez-pas", + ), + ), + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5ea6", + cms_locale_id="66f6e966c9e1dc700a857ca4", + field_data=CollectionItemWithIdInputFieldData( + name="No Entrar en Pánico", + slug="no-entrar-en-panico", + ), + ), + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5eaa", + cms_locale_id="66f6e966c9e1dc700a857ca5", + field_data=CollectionItemWithIdInputFieldData( + name="Au Revoir et Merci pour Tous les Poissons", + slug="au-revoir-et-merci", + ), + ), + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5eaa", + cms_locale_id="66f6e966c9e1dc700a857ca4", + field_data=CollectionItemWithIdInputFieldData( + name="Hasta Luego y Gracias por Todo el Pescado", + slug="hasta-luego-y-gracias", + ), + ), + ], + ) + """ + _response = self._client_wrapper.httpx_client.request( + f"collections/{jsonable_encoder(collection_id)}/items", + method="PATCH", + json={"items": items}, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return pydantic_v1.parse_obj_as(CollectionItem, _response.json()) # type: ignore + if _response.status_code == 400: + raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + if _response.status_code == 401: + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -246,7 +392,9 @@ def list_items_live( request_options: typing.Optional[RequestOptions] = None, ) -> CollectionItemList: """ - List of all live Items within a Collection.

Required scope | `CMS:read` + List of all live Items within a Collection. + + Required scope | `CMS:read` Parameters ---------- @@ -290,7 +438,7 @@ def list_items_live( access_token="YOUR_ACCESS_TOKEN", ) client.collections.items.list_items_live( - collection_id="collection_id", + collection_id="580e63fc8c9a982ac9b8b745", ) """ _response = self._client_wrapper.httpx_client.request( @@ -313,13 +461,13 @@ def list_items_live( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -329,46 +477,96 @@ def create_item_live( self, collection_id: str, *, - id: str, - cms_locale_id: typing.Optional[str] = OMIT, - last_published: typing.Optional[str] = OMIT, - last_updated: typing.Optional[str] = OMIT, - created_on: typing.Optional[str] = OMIT, - is_archived: typing.Optional[bool] = OMIT, - is_draft: typing.Optional[bool] = OMIT, - field_data: typing.Optional[CollectionItemFieldData] = OMIT, + request: ItemsCreateItemLiveRequest, request_options: typing.Optional[RequestOptions] = None, - ) -> None: + ) -> CollectionItem: """ - Create live Item in a Collection. This Item will be published to the live site.

To create items across multiple locales, please use this endpoint.

Required scope | `CMS:write` + Create live Item(s) in a Collection. The Item(s) will be published to the live site. + + To create items across multiple locales, [please use this endpoint.](/v2.0.0/data/reference/cms/collection-items/staged-items/create-items) + + Required scope | `CMS:write` Parameters ---------- collection_id : str Unique identifier for a Collection - id : str - Unique identifier for the Item + request : ItemsCreateItemLiveRequest - cms_locale_id : typing.Optional[str] - Identifier for the locale of the CMS item + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - last_published : typing.Optional[str] - The date the item was last published + Returns + ------- + CollectionItem + Request was successful - last_updated : typing.Optional[str] - The date the item was last updated + Examples + -------- + from webflow import CollectionItem, CollectionItemFieldData + from webflow.client import Webflow - created_on : typing.Optional[str] - The date the item was created + client = Webflow( + access_token="YOUR_ACCESS_TOKEN", + ) + client.collections.items.create_item_live( + collection_id="580e63fc8c9a982ac9b8b745", + request=CollectionItem( + is_archived=False, + is_draft=False, + field_data=CollectionItemFieldData( + name="Pan Galactic Gargle Blaster Recipe", + slug="pan-galactic-gargle-blaster", + ), + ), + ) + """ + _response = self._client_wrapper.httpx_client.request( + f"collections/{jsonable_encoder(collection_id)}/items/live", + method="POST", + json=request, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return pydantic_v1.parse_obj_as(CollectionItem, _response.json()) # type: ignore + if _response.status_code == 400: + raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + if _response.status_code == 401: + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + if _response.status_code == 404: + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + if _response.status_code == 429: + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + if _response.status_code == 500: + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) - is_archived : typing.Optional[bool] - Boolean determining if the Item is set to archived + def delete_items_live( + self, + collection_id: str, + *, + items: typing.Optional[typing.Sequence[ItemsDeleteItemsLiveRequestItemsItem]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Remove an item or multiple items (up to 100 items) from the live site. Deleting published items will unpublish the items from the live site and set them to draft. - is_draft : typing.Optional[bool] - Boolean determining if the Item is set to draft + **Note:** If the `cmsLocaleId` parameter is undefined or empty and the items are localized, items will be unpublished only in the primary locale. + + Required scope | `CMS:write` + + Parameters + ---------- + collection_id : str + Unique identifier for a Collection - field_data : typing.Optional[CollectionItemFieldData] + items : typing.Optional[typing.Sequence[ItemsDeleteItemsLiveRequestItemsItem]] request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -379,40 +577,19 @@ def create_item_live( Examples -------- - from webflow import CollectionItemFieldData from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) - client.collections.items.create_item_live( - collection_id="collection_id", - id="42b720ef280c7a7a3be8cabe", - cms_locale_id="653ad57de882f528b32e810e", - last_published="2022-11-29T16:22:43.159Z", - last_updated="2022-11-17T17:19:43.282Z", - created_on="2022-11-17T17:11:57.148Z", - is_archived=False, - is_draft=False, - field_data=CollectionItemFieldData( - name="Pan Galactic Gargle Blaster Recipe", - slug="pan-galactic-gargle-blaster", - ), + client.collections.items.delete_items_live( + collection_id="580e63fc8c9a982ac9b8b745", ) """ _response = self._client_wrapper.httpx_client.request( f"collections/{jsonable_encoder(collection_id)}/items/live", - method="POST", - json={ - "id": id, - "cmsLocaleId": cms_locale_id, - "lastPublished": last_published, - "lastUpdated": last_updated, - "createdOn": created_on, - "isArchived": is_archived, - "isDraft": is_draft, - "fieldData": field_data, - }, + method="DELETE", + json={"items": items}, request_options=request_options, omit=OMIT, ) @@ -422,91 +599,193 @@ def create_item_live( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + if _response.status_code == 404: + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + if _response.status_code == 429: + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + if _response.status_code == 500: + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def update_items_live( + self, + collection_id: str, + *, + items: typing.Optional[typing.Sequence[CollectionItemWithIdInput]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> CollectionItemListNoPagination: + """ + Update a single live item or multiple live items (up to 100) in a Collection + + **Note:** If the `cmsLocaleId` parameter is undefined or empty and the items are localized, items will be updated only in the primary locale. + + Required scope | `CMS:write` + + Parameters + ---------- + collection_id : str + Unique identifier for a Collection + + items : typing.Optional[typing.Sequence[CollectionItemWithIdInput]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CollectionItemListNoPagination + Request was successful + + Examples + -------- + from webflow import ( + CollectionItemWithIdInput, + CollectionItemWithIdInputFieldData, + ) + from webflow.client import Webflow + + client = Webflow( + access_token="YOUR_ACCESS_TOKEN", + ) + client.collections.items.update_items_live( + collection_id="580e63fc8c9a982ac9b8b745", + items=[ + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5ea6", + cms_locale_id="66f6e966c9e1dc700a857ca5", + field_data=CollectionItemWithIdInputFieldData( + name="Ne Paniquez Pas", + slug="ne-paniquez-pas", + ), + ), + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5ea6", + cms_locale_id="66f6e966c9e1dc700a857ca4", + field_data=CollectionItemWithIdInputFieldData( + name="No Entrar en Pánico", + slug="no-entrar-en-panico", + ), + ), + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5eaa", + cms_locale_id="66f6e966c9e1dc700a857ca5", + field_data=CollectionItemWithIdInputFieldData( + name="Au Revoir et Merci pour Tous les Poissons", + slug="au-revoir-et-merci", + ), + ), + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5eaa", + cms_locale_id="66f6e966c9e1dc700a857ca4", + field_data=CollectionItemWithIdInputFieldData( + name="Hasta Luego y Gracias por Todo el Pescado", + slug="hasta-luego-y-gracias", + ), + ), + ], + ) + """ + _response = self._client_wrapper.httpx_client.request( + f"collections/{jsonable_encoder(collection_id)}/items/live", + method="PATCH", + json={"items": items}, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return pydantic_v1.parse_obj_as(CollectionItemListNoPagination, _response.json()) # type: ignore + if _response.status_code == 400: + raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + if _response.status_code == 401: + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - def create_item_for_multiple_locales( + def create_items( self, collection_id: str, *, - id: str, + field_data: CreateBulkCollectionItemRequestBodyFieldData, cms_locale_ids: typing.Optional[typing.Sequence[str]] = OMIT, - last_published: typing.Optional[str] = OMIT, - last_updated: typing.Optional[str] = OMIT, - created_on: typing.Optional[str] = OMIT, is_archived: typing.Optional[bool] = OMIT, is_draft: typing.Optional[bool] = OMIT, - field_data: typing.Optional[BulkCollectionItemFieldData] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> None: + ) -> BulkCollectionItem: """ - Create single Item in a Collection with multiple corresponding locales.

Required scope | `CMS:write` + Create an item or multiple items in a CMS Collection across multiple corresponding locales. + + **Notes:** + + - This endpoint can create up to 100 items in a request. + - If the `cmsLocaleIds` parameter is undefined or empty and localization is enabled, items will only be created in the primary locale. + + Required scope | `CMS:write` Parameters ---------- collection_id : str Unique identifier for a Collection - id : str - Unique identifier for the Item + field_data : CreateBulkCollectionItemRequestBodyFieldData cms_locale_ids : typing.Optional[typing.Sequence[str]] Array of identifiers for the locales where the item will be created - last_published : typing.Optional[str] - The date the item was last published - - last_updated : typing.Optional[str] - The date the item was last updated - - created_on : typing.Optional[str] - The date the item was created - is_archived : typing.Optional[bool] - Boolean determining if the Item is set to archived + Indicates whether the item is archived. is_draft : typing.Optional[bool] - Boolean determining if the Item is set to draft - - field_data : typing.Optional[BulkCollectionItemFieldData] + Indicates whether the item is in draft state. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - None + BulkCollectionItem + Request was successful Examples -------- from webflow.client import Webflow + from webflow.resources.collections import SingleCmsItem client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) - client.collections.items.create_item_for_multiple_locales( - collection_id="collection_id", - id="580e64008c9a982ac9b8b754", + client.collections.items.create_items( + collection_id="580e63fc8c9a982ac9b8b745", + cms_locale_ids=[ + "66f6e966c9e1dc700a857ca3", + "66f6e966c9e1dc700a857ca4", + "66f6e966c9e1dc700a857ca5", + ], + is_archived=False, + is_draft=False, + field_data=SingleCmsItem( + name="Don’t Panic", + slug="dont-panic", + ), ) """ _response = self._client_wrapper.httpx_client.request( f"collections/{jsonable_encoder(collection_id)}/items/bulk", method="POST", json={ - "id": id, "cmsLocaleIds": cms_locale_ids, - "lastPublished": last_published, - "lastUpdated": last_updated, - "createdOn": created_on, "isArchived": is_archived, "isDraft": is_draft, "fieldData": field_data, @@ -516,17 +795,17 @@ def create_item_for_multiple_locales( ) try: if 200 <= _response.status_code < 300: - return + return pydantic_v1.parse_obj_as(BulkCollectionItem, _response.json()) # type: ignore if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -541,7 +820,9 @@ def get_item( request_options: typing.Optional[RequestOptions] = None, ) -> CollectionItem: """ - Get details of a selected Collection Item.

Required scope | `CMS:read` + Get details of a selected Collection Item. + + Required scope | `CMS:read` Parameters ---------- @@ -570,8 +851,8 @@ def get_item( access_token="YOUR_ACCESS_TOKEN", ) client.collections.items.get_item( - collection_id="collection_id", - item_id="item_id", + collection_id="580e63fc8c9a982ac9b8b745", + item_id="580e64008c9a982ac9b8b754", ) """ _response = self._client_wrapper.httpx_client.request( @@ -586,13 +867,13 @@ def get_item( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -607,7 +888,9 @@ def delete_item( request_options: typing.Optional[RequestOptions] = None, ) -> None: """ - Delete an Item from a Collection. This endpoint does not currently support bulk deletion.

Required scope | `CMS:write` + Delete an Item from a Collection. This endpoint does not currently support bulk deletion. + + Required scope | `CMS:write` Parameters ---------- @@ -635,8 +918,8 @@ def delete_item( access_token="YOUR_ACCESS_TOKEN", ) client.collections.items.delete_item( - collection_id="collection_id", - item_id="item_id", + collection_id="580e63fc8c9a982ac9b8b745", + item_id="580e64008c9a982ac9b8b754", ) """ _response = self._client_wrapper.httpx_client.request( @@ -651,13 +934,13 @@ def delete_item( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -668,18 +951,20 @@ def update_item( collection_id: str, item_id: str, *, - id: str, + id: typing.Optional[str] = OMIT, cms_locale_id: typing.Optional[str] = OMIT, last_published: typing.Optional[str] = OMIT, last_updated: typing.Optional[str] = OMIT, created_on: typing.Optional[str] = OMIT, is_archived: typing.Optional[bool] = OMIT, is_draft: typing.Optional[bool] = OMIT, - field_data: typing.Optional[CollectionItemFieldData] = OMIT, + field_data: typing.Optional[CollectionItemPatchSingleFieldData] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> CollectionItem: """ - Update a selected Item in a Collection.

Required scope | `CMS:write` + Update a selected Item in a Collection. + + Required scope | `CMS:write` Parameters ---------- @@ -689,7 +974,7 @@ def update_item( item_id : str Unique identifier for an Item - id : str + id : typing.Optional[str] Unique identifier for the Item cms_locale_id : typing.Optional[str] @@ -710,7 +995,7 @@ def update_item( is_draft : typing.Optional[bool] Boolean determining if the Item is set to draft - field_data : typing.Optional[CollectionItemFieldData] + field_data : typing.Optional[CollectionItemPatchSingleFieldData] request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -722,23 +1007,18 @@ def update_item( Examples -------- - from webflow import CollectionItemFieldData + from webflow import CollectionItemPatchSingleFieldData from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) client.collections.items.update_item( - collection_id="collection_id", - item_id="item_id", - id="42b720ef280c7a7a3be8cabe", - cms_locale_id="653ad57de882f528b32e810e", - last_published="2022-11-29T16:22:43.159Z", - last_updated="2022-11-17T17:19:43.282Z", - created_on="2022-11-17T17:11:57.148Z", + collection_id="580e63fc8c9a982ac9b8b745", + item_id="580e64008c9a982ac9b8b754", is_archived=False, is_draft=False, - field_data=CollectionItemFieldData( + field_data=CollectionItemPatchSingleFieldData( name="Pan Galactic Gargle Blaster Recipe", slug="pan-galactic-gargle-blaster", ), @@ -766,13 +1046,13 @@ def update_item( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -787,7 +1067,9 @@ def get_item_live( request_options: typing.Optional[RequestOptions] = None, ) -> CollectionItem: """ - Get details of a selected Collection live Item.

Required scope | `CMS:read` + Get details of a selected Collection live Item. + + Required scope | `CMS:read` Parameters ---------- @@ -816,8 +1098,8 @@ def get_item_live( access_token="YOUR_ACCESS_TOKEN", ) client.collections.items.get_item_live( - collection_id="collection_id", - item_id="item_id", + collection_id="580e63fc8c9a982ac9b8b745", + item_id="580e64008c9a982ac9b8b754", ) """ _response = self._client_wrapper.httpx_client.request( @@ -832,13 +1114,13 @@ def get_item_live( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -853,7 +1135,11 @@ def delete_item_live( request_options: typing.Optional[RequestOptions] = None, ) -> None: """ - Remove a live item from the site. Removing a published item will unpublish the item from the live site and set it to draft. This endpoint does not currently support bulk deletion.

Required scope | `CMS:write` + Remove a live item from the site. Removing a published item will unpublish the item from the live site and set it to draft. + + This endpoint does not currently support bulk deletion. + + Required scope | `CMS:write` Parameters ---------- @@ -881,8 +1167,8 @@ def delete_item_live( access_token="YOUR_ACCESS_TOKEN", ) client.collections.items.delete_item_live( - collection_id="collection_id", - item_id="item_id", + collection_id="580e63fc8c9a982ac9b8b745", + item_id="580e64008c9a982ac9b8b754", ) """ _response = self._client_wrapper.httpx_client.request( @@ -897,13 +1183,13 @@ def delete_item_live( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -914,18 +1200,20 @@ def update_item_live( collection_id: str, item_id: str, *, - id: str, + id: typing.Optional[str] = OMIT, cms_locale_id: typing.Optional[str] = OMIT, last_published: typing.Optional[str] = OMIT, last_updated: typing.Optional[str] = OMIT, created_on: typing.Optional[str] = OMIT, is_archived: typing.Optional[bool] = OMIT, is_draft: typing.Optional[bool] = OMIT, - field_data: typing.Optional[CollectionItemFieldData] = OMIT, + field_data: typing.Optional[CollectionItemPatchSingleFieldData] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> CollectionItem: """ - Update a selected live Item in a Collection. The updates for this Item will be published to the live site.

Required scope | `CMS:write` + Update a selected live Item in a Collection. The updates for this Item will be published to the live site. + + Required scope | `CMS:write` Parameters ---------- @@ -935,7 +1223,7 @@ def update_item_live( item_id : str Unique identifier for an Item - id : str + id : typing.Optional[str] Unique identifier for the Item cms_locale_id : typing.Optional[str] @@ -956,7 +1244,7 @@ def update_item_live( is_draft : typing.Optional[bool] Boolean determining if the Item is set to draft - field_data : typing.Optional[CollectionItemFieldData] + field_data : typing.Optional[CollectionItemPatchSingleFieldData] request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -968,23 +1256,18 @@ def update_item_live( Examples -------- - from webflow import CollectionItemFieldData + from webflow import CollectionItemPatchSingleFieldData from webflow.client import Webflow client = Webflow( access_token="YOUR_ACCESS_TOKEN", ) client.collections.items.update_item_live( - collection_id="collection_id", - item_id="item_id", - id="42b720ef280c7a7a3be8cabe", - cms_locale_id="653ad57de882f528b32e810e", - last_published="2022-11-29T16:22:43.159Z", - last_updated="2022-11-17T17:19:43.282Z", - created_on="2022-11-17T17:11:57.148Z", + collection_id="580e63fc8c9a982ac9b8b745", + item_id="580e64008c9a982ac9b8b754", is_archived=False, is_draft=False, - field_data=CollectionItemFieldData( + field_data=CollectionItemPatchSingleFieldData( name="Pan Galactic Gargle Blaster Recipe", slug="pan-galactic-gargle-blaster", ), @@ -1008,89 +1291,432 @@ def update_item_live( ) try: if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(CollectionItem, _response.json()) # type: ignore + return pydantic_v1.parse_obj_as(CollectionItem, _response.json()) # type: ignore + if _response.status_code == 400: + raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + if _response.status_code == 401: + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + if _response.status_code == 404: + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + if _response.status_code == 429: + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + if _response.status_code == 500: + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def publish_item( + self, + collection_id: str, + *, + item_ids: typing.Sequence[str], + request_options: typing.Optional[RequestOptions] = None, + ) -> ItemsPublishItemResponse: + """ + Publish an item or multiple items. + + Required scope | `cms:write` + + Parameters + ---------- + collection_id : str + Unique identifier for a Collection + + item_ids : typing.Sequence[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ItemsPublishItemResponse + Request was successful + + Examples + -------- + from webflow.client import Webflow + + client = Webflow( + access_token="YOUR_ACCESS_TOKEN", + ) + client.collections.items.publish_item( + collection_id="580e63fc8c9a982ac9b8b745", + item_ids=["itemIds"], + ) + """ + _response = self._client_wrapper.httpx_client.request( + f"collections/{jsonable_encoder(collection_id)}/items/publish", + method="POST", + json={"itemIds": item_ids}, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return pydantic_v1.parse_obj_as(ItemsPublishItemResponse, _response.json()) # type: ignore + if _response.status_code == 400: + raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + if _response.status_code == 401: + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + if _response.status_code == 404: + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + if _response.status_code == 409: + raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + if _response.status_code == 429: + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + if _response.status_code == 500: + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + +class AsyncItemsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list_items( + self, + collection_id: str, + *, + cms_locale_id: typing.Optional[str] = None, + offset: typing.Optional[float] = None, + limit: typing.Optional[float] = None, + name: typing.Optional[str] = None, + slug: typing.Optional[str] = None, + sort_by: typing.Optional[ItemsListItemsRequestSortBy] = None, + sort_order: typing.Optional[ItemsListItemsRequestSortOrder] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> CollectionItemList: + """ + List of all Items within a Collection. + + Required scope | `CMS:read` + + Parameters + ---------- + collection_id : str + Unique identifier for a Collection + + cms_locale_id : typing.Optional[str] + Unique identifier for a CMS Locale. This UID is different from the Site locale identifier and is listed as `cmsLocaleId` in the Sites response. To query multiple locales, input a comma separated string. + + offset : typing.Optional[float] + Offset used for pagination if the results have more than limit records + + limit : typing.Optional[float] + Maximum number of records to be returned (max limit: 100) + + name : typing.Optional[str] + The name of the item(s) + + slug : typing.Optional[str] + The slug of the item + + sort_by : typing.Optional[ItemsListItemsRequestSortBy] + Sort results by the provided value + + sort_order : typing.Optional[ItemsListItemsRequestSortOrder] + Sorts the results by asc or desc + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CollectionItemList + Request was successful + + Examples + -------- + from webflow.client import AsyncWebflow + + client = AsyncWebflow( + access_token="YOUR_ACCESS_TOKEN", + ) + await client.collections.items.list_items( + collection_id="580e63fc8c9a982ac9b8b745", + ) + """ + _response = await self._client_wrapper.httpx_client.request( + f"collections/{jsonable_encoder(collection_id)}/items", + method="GET", + params={ + "cmsLocaleId": cms_locale_id, + "offset": offset, + "limit": limit, + "name": name, + "slug": slug, + "sortBy": sort_by, + "sortOrder": sort_order, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return pydantic_v1.parse_obj_as(CollectionItemList, _response.json()) # type: ignore + if _response.status_code == 400: + raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + if _response.status_code == 401: + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + if _response.status_code == 404: + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + if _response.status_code == 429: + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + if _response.status_code == 500: + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def create_item( + self, + collection_id: str, + *, + request: ItemsCreateItemRequest, + request_options: typing.Optional[RequestOptions] = None, + ) -> CollectionItem: + """ + Create Item(s) in a Collection. + + To create items across multiple locales, please use [this endpoint.](/v2.0.0/data/reference/cms/collection-items/staged-items/create-items) + + Required scope | `CMS:write` + + Parameters + ---------- + collection_id : str + Unique identifier for a Collection + + request : ItemsCreateItemRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CollectionItem + Request was successful + + Examples + -------- + from webflow import CollectionItemPostSingle, CollectionItemPostSingleFieldData + from webflow.client import AsyncWebflow + + client = AsyncWebflow( + access_token="YOUR_ACCESS_TOKEN", + ) + await client.collections.items.create_item( + collection_id="580e63fc8c9a982ac9b8b745", + request=CollectionItemPostSingle( + is_archived=False, + is_draft=False, + field_data=CollectionItemPostSingleFieldData( + name="Pan Galactic Gargle Blaster Recipe", + slug="pan-galactic-gargle-blaster", + ), + ), + ) + """ + _response = await self._client_wrapper.httpx_client.request( + f"collections/{jsonable_encoder(collection_id)}/items", + method="POST", + json=request, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return pydantic_v1.parse_obj_as(CollectionItem, _response.json()) # type: ignore + if _response.status_code == 400: + raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + if _response.status_code == 401: + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + if _response.status_code == 404: + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + if _response.status_code == 429: + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + if _response.status_code == 500: + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def delete_items( + self, + collection_id: str, + *, + items: typing.Optional[typing.Sequence[ItemsDeleteItemsRequestItemsItem]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Delete Items from a Collection. + + **Note:** If the `cmsLocaleId` parameter is undefined or empty and the items are localized, items will be deleted only in the primary locale. + + Required scope | `CMS:write` + + Parameters + ---------- + collection_id : str + Unique identifier for a Collection + + items : typing.Optional[typing.Sequence[ItemsDeleteItemsRequestItemsItem]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from webflow.client import AsyncWebflow + + client = AsyncWebflow( + access_token="YOUR_ACCESS_TOKEN", + ) + await client.collections.items.delete_items( + collection_id="580e63fc8c9a982ac9b8b745", + ) + """ + _response = await self._client_wrapper.httpx_client.request( + f"collections/{jsonable_encoder(collection_id)}/items", + method="DELETE", + json={"items": items}, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + if _response.status_code == 409: + raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - def publish_item( + async def update_items( self, collection_id: str, *, - item_ids: typing.Sequence[str], + items: typing.Optional[typing.Sequence[CollectionItemWithIdInput]] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> None: + ) -> CollectionItem: """ - Publish an item or multiple items.

Required scope | `cms:write` + Update a single item or multiple items (up to 100) in a Collection. + + **Note:** If the `cmsLocaleId` parameter is undefined or empty and the items are localized, items will be updated only in the primary locale. + + Required scope | `CMS:write` Parameters ---------- collection_id : str Unique identifier for a Collection - item_ids : typing.Sequence[str] + items : typing.Optional[typing.Sequence[CollectionItemWithIdInput]] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - None + CollectionItem + Request was successful Examples -------- - from webflow.client import Webflow + from webflow import ( + CollectionItemWithIdInput, + CollectionItemWithIdInputFieldData, + ) + from webflow.client import AsyncWebflow - client = Webflow( + client = AsyncWebflow( access_token="YOUR_ACCESS_TOKEN", ) - client.collections.items.publish_item( - collection_id="collection_id", - item_ids=["itemIds"], + await client.collections.items.update_items( + collection_id="580e63fc8c9a982ac9b8b745", + items=[ + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5ea6", + cms_locale_id="66f6e966c9e1dc700a857ca5", + field_data=CollectionItemWithIdInputFieldData( + name="Ne Paniquez Pas", + slug="ne-paniquez-pas", + ), + ), + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5ea6", + cms_locale_id="66f6e966c9e1dc700a857ca4", + field_data=CollectionItemWithIdInputFieldData( + name="No Entrar en Pánico", + slug="no-entrar-en-panico", + ), + ), + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5eaa", + cms_locale_id="66f6e966c9e1dc700a857ca5", + field_data=CollectionItemWithIdInputFieldData( + name="Au Revoir et Merci pour Tous les Poissons", + slug="au-revoir-et-merci", + ), + ), + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5eaa", + cms_locale_id="66f6e966c9e1dc700a857ca4", + field_data=CollectionItemWithIdInputFieldData( + name="Hasta Luego y Gracias por Todo el Pescado", + slug="hasta-luego-y-gracias", + ), + ), + ], ) """ - _response = self._client_wrapper.httpx_client.request( - f"collections/{jsonable_encoder(collection_id)}/items/publish", - method="POST", - json={"itemIds": item_ids}, + _response = await self._client_wrapper.httpx_client.request( + f"collections/{jsonable_encoder(collection_id)}/items", + method="PATCH", + json={"items": items}, request_options=request_options, omit=OMIT, ) try: if 200 <= _response.status_code < 300: - return + return pydantic_v1.parse_obj_as(CollectionItem, _response.json()) # type: ignore if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - -class AsyncItemsClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - - async def list_items( + async def list_items_live( self, collection_id: str, *, @@ -1099,12 +1725,14 @@ async def list_items( limit: typing.Optional[float] = None, name: typing.Optional[str] = None, slug: typing.Optional[str] = None, - sort_by: typing.Optional[ItemsListItemsRequestSortBy] = None, - sort_order: typing.Optional[ItemsListItemsRequestSortOrder] = None, + sort_by: typing.Optional[ItemsListItemsLiveRequestSortBy] = None, + sort_order: typing.Optional[ItemsListItemsLiveRequestSortOrder] = None, request_options: typing.Optional[RequestOptions] = None, ) -> CollectionItemList: """ - List of all Items within a Collection.

Required scope | `CMS:read` + List of all live Items within a Collection. + + Required scope | `CMS:read` Parameters ---------- @@ -1126,10 +1754,10 @@ async def list_items( slug : typing.Optional[str] The slug of the item - sort_by : typing.Optional[ItemsListItemsRequestSortBy] + sort_by : typing.Optional[ItemsListItemsLiveRequestSortBy] Sort results by the provided value - sort_order : typing.Optional[ItemsListItemsRequestSortOrder] + sort_order : typing.Optional[ItemsListItemsLiveRequestSortOrder] Sorts the results by asc or desc request_options : typing.Optional[RequestOptions] @@ -1147,12 +1775,12 @@ async def list_items( client = AsyncWebflow( access_token="YOUR_ACCESS_TOKEN", ) - await client.collections.items.list_items( - collection_id="collection_id", + await client.collections.items.list_items_live( + collection_id="580e63fc8c9a982ac9b8b745", ) """ _response = await self._client_wrapper.httpx_client.request( - f"collections/{jsonable_encoder(collection_id)}/items", + f"collections/{jsonable_encoder(collection_id)}/items/live", method="GET", params={ "cmsLocaleId": cms_locale_id, @@ -1171,176 +1799,119 @@ async def list_items( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - async def create_item( + async def create_item_live( self, collection_id: str, *, - id: str, - cms_locale_id: typing.Optional[str] = OMIT, - last_published: typing.Optional[str] = OMIT, - last_updated: typing.Optional[str] = OMIT, - created_on: typing.Optional[str] = OMIT, - is_archived: typing.Optional[bool] = OMIT, - is_draft: typing.Optional[bool] = OMIT, - field_data: typing.Optional[CollectionItemFieldData] = OMIT, + request: ItemsCreateItemLiveRequest, request_options: typing.Optional[RequestOptions] = None, - ) -> None: + ) -> CollectionItem: """ - Create Item in a Collection.

To create items across multiple locales, please use this endpoint.

Required scope | `CMS:write` + Create live Item(s) in a Collection. The Item(s) will be published to the live site. + + To create items across multiple locales, [please use this endpoint.](/v2.0.0/data/reference/cms/collection-items/staged-items/create-items) + + Required scope | `CMS:write` Parameters ---------- collection_id : str Unique identifier for a Collection - id : str - Unique identifier for the Item - - cms_locale_id : typing.Optional[str] - Identifier for the locale of the CMS item - - last_published : typing.Optional[str] - The date the item was last published - - last_updated : typing.Optional[str] - The date the item was last updated - - created_on : typing.Optional[str] - The date the item was created - - is_archived : typing.Optional[bool] - Boolean determining if the Item is set to archived - - is_draft : typing.Optional[bool] - Boolean determining if the Item is set to draft - - field_data : typing.Optional[CollectionItemFieldData] + request : ItemsCreateItemLiveRequest request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - None + CollectionItem + Request was successful Examples -------- - from webflow import CollectionItemFieldData + from webflow import CollectionItem, CollectionItemFieldData from webflow.client import AsyncWebflow client = AsyncWebflow( access_token="YOUR_ACCESS_TOKEN", ) - await client.collections.items.create_item( - collection_id="collection_id", - id="42b720ef280c7a7a3be8cabe", - cms_locale_id="653ad57de882f528b32e810e", - last_published="2022-11-29T16:22:43.159Z", - last_updated="2022-11-17T17:19:43.282Z", - created_on="2022-11-17T17:11:57.148Z", - is_archived=False, - is_draft=False, - field_data=CollectionItemFieldData( - name="Pan Galactic Gargle Blaster Recipe", - slug="pan-galactic-gargle-blaster", + await client.collections.items.create_item_live( + collection_id="580e63fc8c9a982ac9b8b745", + request=CollectionItem( + is_archived=False, + is_draft=False, + field_data=CollectionItemFieldData( + name="Pan Galactic Gargle Blaster Recipe", + slug="pan-galactic-gargle-blaster", + ), ), ) """ _response = await self._client_wrapper.httpx_client.request( - f"collections/{jsonable_encoder(collection_id)}/items", + f"collections/{jsonable_encoder(collection_id)}/items/live", method="POST", - json={ - "id": id, - "cmsLocaleId": cms_locale_id, - "lastPublished": last_published, - "lastUpdated": last_updated, - "createdOn": created_on, - "isArchived": is_archived, - "isDraft": is_draft, - "fieldData": field_data, - }, + json=request, request_options=request_options, omit=OMIT, ) try: if 200 <= _response.status_code < 300: - return + return pydantic_v1.parse_obj_as(CollectionItem, _response.json()) # type: ignore if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - async def list_items_live( + async def delete_items_live( self, collection_id: str, *, - cms_locale_id: typing.Optional[str] = None, - offset: typing.Optional[float] = None, - limit: typing.Optional[float] = None, - name: typing.Optional[str] = None, - slug: typing.Optional[str] = None, - sort_by: typing.Optional[ItemsListItemsLiveRequestSortBy] = None, - sort_order: typing.Optional[ItemsListItemsLiveRequestSortOrder] = None, + items: typing.Optional[typing.Sequence[ItemsDeleteItemsLiveRequestItemsItem]] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> CollectionItemList: + ) -> None: """ - List of all live Items within a Collection.

Required scope | `CMS:read` + Remove an item or multiple items (up to 100 items) from the live site. Deleting published items will unpublish the items from the live site and set them to draft. + + **Note:** If the `cmsLocaleId` parameter is undefined or empty and the items are localized, items will be unpublished only in the primary locale. + + Required scope | `CMS:write` Parameters ---------- collection_id : str Unique identifier for a Collection - cms_locale_id : typing.Optional[str] - Unique identifier for a CMS Locale. This UID is different from the Site locale identifier and is listed as `cmsLocaleId` in the Sites response. To query multiple locales, input a comma separated string. - - offset : typing.Optional[float] - Offset used for pagination if the results have more than limit records - - limit : typing.Optional[float] - Maximum number of records to be returned (max limit: 100) - - name : typing.Optional[str] - The name of the item(s) - - slug : typing.Optional[str] - The slug of the item - - sort_by : typing.Optional[ItemsListItemsLiveRequestSortBy] - Sort results by the provided value - - sort_order : typing.Optional[ItemsListItemsLiveRequestSortOrder] - Sorts the results by asc or desc + items : typing.Optional[typing.Sequence[ItemsDeleteItemsLiveRequestItemsItem]] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - CollectionItemList - Request was successful + None Examples -------- @@ -1349,224 +1920,210 @@ async def list_items_live( client = AsyncWebflow( access_token="YOUR_ACCESS_TOKEN", ) - await client.collections.items.list_items_live( - collection_id="collection_id", + await client.collections.items.delete_items_live( + collection_id="580e63fc8c9a982ac9b8b745", ) """ _response = await self._client_wrapper.httpx_client.request( f"collections/{jsonable_encoder(collection_id)}/items/live", - method="GET", - params={ - "cmsLocaleId": cms_locale_id, - "offset": offset, - "limit": limit, - "name": name, - "slug": slug, - "sortBy": sort_by, - "sortOrder": sort_order, - }, + method="DELETE", + json={"items": items}, request_options=request_options, + omit=OMIT, ) try: if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(CollectionItemList, _response.json()) # type: ignore + return if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - async def create_item_live( + async def update_items_live( self, collection_id: str, *, - id: str, - cms_locale_id: typing.Optional[str] = OMIT, - last_published: typing.Optional[str] = OMIT, - last_updated: typing.Optional[str] = OMIT, - created_on: typing.Optional[str] = OMIT, - is_archived: typing.Optional[bool] = OMIT, - is_draft: typing.Optional[bool] = OMIT, - field_data: typing.Optional[CollectionItemFieldData] = OMIT, + items: typing.Optional[typing.Sequence[CollectionItemWithIdInput]] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> None: + ) -> CollectionItemListNoPagination: """ - Create live Item in a Collection. This Item will be published to the live site.

To create items across multiple locales, please use this endpoint.

Required scope | `CMS:write` + Update a single live item or multiple live items (up to 100) in a Collection + + **Note:** If the `cmsLocaleId` parameter is undefined or empty and the items are localized, items will be updated only in the primary locale. + + Required scope | `CMS:write` Parameters ---------- collection_id : str Unique identifier for a Collection - id : str - Unique identifier for the Item - - cms_locale_id : typing.Optional[str] - Identifier for the locale of the CMS item - - last_published : typing.Optional[str] - The date the item was last published - - last_updated : typing.Optional[str] - The date the item was last updated - - created_on : typing.Optional[str] - The date the item was created - - is_archived : typing.Optional[bool] - Boolean determining if the Item is set to archived - - is_draft : typing.Optional[bool] - Boolean determining if the Item is set to draft - - field_data : typing.Optional[CollectionItemFieldData] + items : typing.Optional[typing.Sequence[CollectionItemWithIdInput]] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - None + CollectionItemListNoPagination + Request was successful Examples -------- - from webflow import CollectionItemFieldData + from webflow import ( + CollectionItemWithIdInput, + CollectionItemWithIdInputFieldData, + ) from webflow.client import AsyncWebflow client = AsyncWebflow( access_token="YOUR_ACCESS_TOKEN", ) - await client.collections.items.create_item_live( - collection_id="collection_id", - id="42b720ef280c7a7a3be8cabe", - cms_locale_id="653ad57de882f528b32e810e", - last_published="2022-11-29T16:22:43.159Z", - last_updated="2022-11-17T17:19:43.282Z", - created_on="2022-11-17T17:11:57.148Z", - is_archived=False, - is_draft=False, - field_data=CollectionItemFieldData( - name="Pan Galactic Gargle Blaster Recipe", - slug="pan-galactic-gargle-blaster", - ), + await client.collections.items.update_items_live( + collection_id="580e63fc8c9a982ac9b8b745", + items=[ + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5ea6", + cms_locale_id="66f6e966c9e1dc700a857ca5", + field_data=CollectionItemWithIdInputFieldData( + name="Ne Paniquez Pas", + slug="ne-paniquez-pas", + ), + ), + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5ea6", + cms_locale_id="66f6e966c9e1dc700a857ca4", + field_data=CollectionItemWithIdInputFieldData( + name="No Entrar en Pánico", + slug="no-entrar-en-panico", + ), + ), + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5eaa", + cms_locale_id="66f6e966c9e1dc700a857ca5", + field_data=CollectionItemWithIdInputFieldData( + name="Au Revoir et Merci pour Tous les Poissons", + slug="au-revoir-et-merci", + ), + ), + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5eaa", + cms_locale_id="66f6e966c9e1dc700a857ca4", + field_data=CollectionItemWithIdInputFieldData( + name="Hasta Luego y Gracias por Todo el Pescado", + slug="hasta-luego-y-gracias", + ), + ), + ], ) """ _response = await self._client_wrapper.httpx_client.request( f"collections/{jsonable_encoder(collection_id)}/items/live", - method="POST", - json={ - "id": id, - "cmsLocaleId": cms_locale_id, - "lastPublished": last_published, - "lastUpdated": last_updated, - "createdOn": created_on, - "isArchived": is_archived, - "isDraft": is_draft, - "fieldData": field_data, - }, + method="PATCH", + json={"items": items}, request_options=request_options, omit=OMIT, ) try: if 200 <= _response.status_code < 300: - return + return pydantic_v1.parse_obj_as(CollectionItemListNoPagination, _response.json()) # type: ignore if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - async def create_item_for_multiple_locales( + async def create_items( self, collection_id: str, *, - id: str, + field_data: CreateBulkCollectionItemRequestBodyFieldData, cms_locale_ids: typing.Optional[typing.Sequence[str]] = OMIT, - last_published: typing.Optional[str] = OMIT, - last_updated: typing.Optional[str] = OMIT, - created_on: typing.Optional[str] = OMIT, is_archived: typing.Optional[bool] = OMIT, is_draft: typing.Optional[bool] = OMIT, - field_data: typing.Optional[BulkCollectionItemFieldData] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> None: + ) -> BulkCollectionItem: """ - Create single Item in a Collection with multiple corresponding locales.

Required scope | `CMS:write` + Create an item or multiple items in a CMS Collection across multiple corresponding locales. + + **Notes:** + + - This endpoint can create up to 100 items in a request. + - If the `cmsLocaleIds` parameter is undefined or empty and localization is enabled, items will only be created in the primary locale. + + Required scope | `CMS:write` Parameters ---------- collection_id : str Unique identifier for a Collection - id : str - Unique identifier for the Item + field_data : CreateBulkCollectionItemRequestBodyFieldData cms_locale_ids : typing.Optional[typing.Sequence[str]] Array of identifiers for the locales where the item will be created - last_published : typing.Optional[str] - The date the item was last published - - last_updated : typing.Optional[str] - The date the item was last updated - - created_on : typing.Optional[str] - The date the item was created - is_archived : typing.Optional[bool] - Boolean determining if the Item is set to archived + Indicates whether the item is archived. is_draft : typing.Optional[bool] - Boolean determining if the Item is set to draft - - field_data : typing.Optional[BulkCollectionItemFieldData] + Indicates whether the item is in draft state. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - None + BulkCollectionItem + Request was successful Examples -------- from webflow.client import AsyncWebflow + from webflow.resources.collections import SingleCmsItem client = AsyncWebflow( access_token="YOUR_ACCESS_TOKEN", ) - await client.collections.items.create_item_for_multiple_locales( - collection_id="collection_id", - id="580e64008c9a982ac9b8b754", + await client.collections.items.create_items( + collection_id="580e63fc8c9a982ac9b8b745", + cms_locale_ids=[ + "66f6e966c9e1dc700a857ca3", + "66f6e966c9e1dc700a857ca4", + "66f6e966c9e1dc700a857ca5", + ], + is_archived=False, + is_draft=False, + field_data=SingleCmsItem( + name="Don’t Panic", + slug="dont-panic", + ), ) """ _response = await self._client_wrapper.httpx_client.request( f"collections/{jsonable_encoder(collection_id)}/items/bulk", method="POST", json={ - "id": id, "cmsLocaleIds": cms_locale_ids, - "lastPublished": last_published, - "lastUpdated": last_updated, - "createdOn": created_on, "isArchived": is_archived, "isDraft": is_draft, "fieldData": field_data, @@ -1576,17 +2133,17 @@ async def create_item_for_multiple_locales( ) try: if 200 <= _response.status_code < 300: - return + return pydantic_v1.parse_obj_as(BulkCollectionItem, _response.json()) # type: ignore if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -1601,7 +2158,9 @@ async def get_item( request_options: typing.Optional[RequestOptions] = None, ) -> CollectionItem: """ - Get details of a selected Collection Item.

Required scope | `CMS:read` + Get details of a selected Collection Item. + + Required scope | `CMS:read` Parameters ---------- @@ -1630,8 +2189,8 @@ async def get_item( access_token="YOUR_ACCESS_TOKEN", ) await client.collections.items.get_item( - collection_id="collection_id", - item_id="item_id", + collection_id="580e63fc8c9a982ac9b8b745", + item_id="580e64008c9a982ac9b8b754", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -1646,13 +2205,13 @@ async def get_item( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -1667,7 +2226,9 @@ async def delete_item( request_options: typing.Optional[RequestOptions] = None, ) -> None: """ - Delete an Item from a Collection. This endpoint does not currently support bulk deletion.

Required scope | `CMS:write` + Delete an Item from a Collection. This endpoint does not currently support bulk deletion. + + Required scope | `CMS:write` Parameters ---------- @@ -1695,8 +2256,8 @@ async def delete_item( access_token="YOUR_ACCESS_TOKEN", ) await client.collections.items.delete_item( - collection_id="collection_id", - item_id="item_id", + collection_id="580e63fc8c9a982ac9b8b745", + item_id="580e64008c9a982ac9b8b754", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -1711,13 +2272,13 @@ async def delete_item( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -1728,18 +2289,20 @@ async def update_item( collection_id: str, item_id: str, *, - id: str, + id: typing.Optional[str] = OMIT, cms_locale_id: typing.Optional[str] = OMIT, last_published: typing.Optional[str] = OMIT, last_updated: typing.Optional[str] = OMIT, created_on: typing.Optional[str] = OMIT, is_archived: typing.Optional[bool] = OMIT, is_draft: typing.Optional[bool] = OMIT, - field_data: typing.Optional[CollectionItemFieldData] = OMIT, + field_data: typing.Optional[CollectionItemPatchSingleFieldData] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> CollectionItem: """ - Update a selected Item in a Collection.

Required scope | `CMS:write` + Update a selected Item in a Collection. + + Required scope | `CMS:write` Parameters ---------- @@ -1749,7 +2312,7 @@ async def update_item( item_id : str Unique identifier for an Item - id : str + id : typing.Optional[str] Unique identifier for the Item cms_locale_id : typing.Optional[str] @@ -1770,7 +2333,7 @@ async def update_item( is_draft : typing.Optional[bool] Boolean determining if the Item is set to draft - field_data : typing.Optional[CollectionItemFieldData] + field_data : typing.Optional[CollectionItemPatchSingleFieldData] request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -1782,23 +2345,18 @@ async def update_item( Examples -------- - from webflow import CollectionItemFieldData + from webflow import CollectionItemPatchSingleFieldData from webflow.client import AsyncWebflow client = AsyncWebflow( access_token="YOUR_ACCESS_TOKEN", ) await client.collections.items.update_item( - collection_id="collection_id", - item_id="item_id", - id="42b720ef280c7a7a3be8cabe", - cms_locale_id="653ad57de882f528b32e810e", - last_published="2022-11-29T16:22:43.159Z", - last_updated="2022-11-17T17:19:43.282Z", - created_on="2022-11-17T17:11:57.148Z", + collection_id="580e63fc8c9a982ac9b8b745", + item_id="580e64008c9a982ac9b8b754", is_archived=False, is_draft=False, - field_data=CollectionItemFieldData( + field_data=CollectionItemPatchSingleFieldData( name="Pan Galactic Gargle Blaster Recipe", slug="pan-galactic-gargle-blaster", ), @@ -1826,13 +2384,13 @@ async def update_item( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -1847,7 +2405,9 @@ async def get_item_live( request_options: typing.Optional[RequestOptions] = None, ) -> CollectionItem: """ - Get details of a selected Collection live Item.

Required scope | `CMS:read` + Get details of a selected Collection live Item. + + Required scope | `CMS:read` Parameters ---------- @@ -1876,8 +2436,8 @@ async def get_item_live( access_token="YOUR_ACCESS_TOKEN", ) await client.collections.items.get_item_live( - collection_id="collection_id", - item_id="item_id", + collection_id="580e63fc8c9a982ac9b8b745", + item_id="580e64008c9a982ac9b8b754", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -1892,13 +2452,13 @@ async def get_item_live( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -1913,7 +2473,11 @@ async def delete_item_live( request_options: typing.Optional[RequestOptions] = None, ) -> None: """ - Remove a live item from the site. Removing a published item will unpublish the item from the live site and set it to draft. This endpoint does not currently support bulk deletion.

Required scope | `CMS:write` + Remove a live item from the site. Removing a published item will unpublish the item from the live site and set it to draft. + + This endpoint does not currently support bulk deletion. + + Required scope | `CMS:write` Parameters ---------- @@ -1941,8 +2505,8 @@ async def delete_item_live( access_token="YOUR_ACCESS_TOKEN", ) await client.collections.items.delete_item_live( - collection_id="collection_id", - item_id="item_id", + collection_id="580e63fc8c9a982ac9b8b745", + item_id="580e64008c9a982ac9b8b754", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -1957,13 +2521,13 @@ async def delete_item_live( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -1974,18 +2538,20 @@ async def update_item_live( collection_id: str, item_id: str, *, - id: str, + id: typing.Optional[str] = OMIT, cms_locale_id: typing.Optional[str] = OMIT, last_published: typing.Optional[str] = OMIT, last_updated: typing.Optional[str] = OMIT, created_on: typing.Optional[str] = OMIT, is_archived: typing.Optional[bool] = OMIT, is_draft: typing.Optional[bool] = OMIT, - field_data: typing.Optional[CollectionItemFieldData] = OMIT, + field_data: typing.Optional[CollectionItemPatchSingleFieldData] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> CollectionItem: """ - Update a selected live Item in a Collection. The updates for this Item will be published to the live site.

Required scope | `CMS:write` + Update a selected live Item in a Collection. The updates for this Item will be published to the live site. + + Required scope | `CMS:write` Parameters ---------- @@ -1995,7 +2561,7 @@ async def update_item_live( item_id : str Unique identifier for an Item - id : str + id : typing.Optional[str] Unique identifier for the Item cms_locale_id : typing.Optional[str] @@ -2016,7 +2582,7 @@ async def update_item_live( is_draft : typing.Optional[bool] Boolean determining if the Item is set to draft - field_data : typing.Optional[CollectionItemFieldData] + field_data : typing.Optional[CollectionItemPatchSingleFieldData] request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -2028,23 +2594,18 @@ async def update_item_live( Examples -------- - from webflow import CollectionItemFieldData + from webflow import CollectionItemPatchSingleFieldData from webflow.client import AsyncWebflow client = AsyncWebflow( access_token="YOUR_ACCESS_TOKEN", ) await client.collections.items.update_item_live( - collection_id="collection_id", - item_id="item_id", - id="42b720ef280c7a7a3be8cabe", - cms_locale_id="653ad57de882f528b32e810e", - last_published="2022-11-29T16:22:43.159Z", - last_updated="2022-11-17T17:19:43.282Z", - created_on="2022-11-17T17:11:57.148Z", + collection_id="580e63fc8c9a982ac9b8b745", + item_id="580e64008c9a982ac9b8b754", is_archived=False, is_draft=False, - field_data=CollectionItemFieldData( + field_data=CollectionItemPatchSingleFieldData( name="Pan Galactic Gargle Blaster Recipe", slug="pan-galactic-gargle-blaster", ), @@ -2072,13 +2633,13 @@ async def update_item_live( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -2090,9 +2651,11 @@ async def publish_item( *, item_ids: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None, - ) -> None: + ) -> ItemsPublishItemResponse: """ - Publish an item or multiple items.

Required scope | `cms:write` + Publish an item or multiple items. + + Required scope | `cms:write` Parameters ---------- @@ -2106,7 +2669,8 @@ async def publish_item( Returns ------- - None + ItemsPublishItemResponse + Request was successful Examples -------- @@ -2116,7 +2680,7 @@ async def publish_item( access_token="YOUR_ACCESS_TOKEN", ) await client.collections.items.publish_item( - collection_id="collection_id", + collection_id="580e63fc8c9a982ac9b8b745", item_ids=["itemIds"], ) """ @@ -2129,17 +2693,19 @@ async def publish_item( ) try: if 200 <= _response.status_code < 300: - return + return pydantic_v1.parse_obj_as(ItemsPublishItemResponse, _response.json()) # type: ignore if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore + if _response.status_code == 409: + raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) diff --git a/src/webflow/resources/collections/resources/items/types/__init__.py b/src/webflow/resources/collections/resources/items/types/__init__.py index fc48f35..67040fb 100644 --- a/src/webflow/resources/collections/resources/items/types/__init__.py +++ b/src/webflow/resources/collections/resources/items/types/__init__.py @@ -1,15 +1,33 @@ # This file was auto-generated by Fern from our API Definition. -from .bulk_collection_item_field_data import BulkCollectionItemFieldData +from .create_bulk_collection_item_request_body_field_data import CreateBulkCollectionItemRequestBodyFieldData +from .create_bulk_collection_item_request_body_field_data_item import CreateBulkCollectionItemRequestBodyFieldDataItem +from .items_create_item_live_request import ItemsCreateItemLiveRequest +from .items_create_item_request import ItemsCreateItemRequest +from .items_delete_items_live_request_items_item import ItemsDeleteItemsLiveRequestItemsItem +from .items_delete_items_request_items_item import ItemsDeleteItemsRequestItemsItem from .items_list_items_live_request_sort_by import ItemsListItemsLiveRequestSortBy from .items_list_items_live_request_sort_order import ItemsListItemsLiveRequestSortOrder from .items_list_items_request_sort_by import ItemsListItemsRequestSortBy from .items_list_items_request_sort_order import ItemsListItemsRequestSortOrder +from .items_publish_item_response import ItemsPublishItemResponse +from .multiple_items import MultipleItems +from .multiple_live_items import MultipleLiveItems +from .single_cms_item import SingleCmsItem __all__ = [ - "BulkCollectionItemFieldData", + "CreateBulkCollectionItemRequestBodyFieldData", + "CreateBulkCollectionItemRequestBodyFieldDataItem", + "ItemsCreateItemLiveRequest", + "ItemsCreateItemRequest", + "ItemsDeleteItemsLiveRequestItemsItem", + "ItemsDeleteItemsRequestItemsItem", "ItemsListItemsLiveRequestSortBy", "ItemsListItemsLiveRequestSortOrder", "ItemsListItemsRequestSortBy", "ItemsListItemsRequestSortOrder", + "ItemsPublishItemResponse", + "MultipleItems", + "MultipleLiveItems", + "SingleCmsItem", ] diff --git a/src/webflow/resources/collections/resources/items/types/create_bulk_collection_item_request_body_field_data.py b/src/webflow/resources/collections/resources/items/types/create_bulk_collection_item_request_body_field_data.py new file mode 100644 index 0000000..01411c8 --- /dev/null +++ b/src/webflow/resources/collections/resources/items/types/create_bulk_collection_item_request_body_field_data.py @@ -0,0 +1,10 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .create_bulk_collection_item_request_body_field_data_item import CreateBulkCollectionItemRequestBodyFieldDataItem +from .single_cms_item import SingleCmsItem + +CreateBulkCollectionItemRequestBodyFieldData = typing.Union[ + SingleCmsItem, typing.List[CreateBulkCollectionItemRequestBodyFieldDataItem] +] diff --git a/src/webflow/resources/collections/resources/items/types/create_bulk_collection_item_request_body_field_data_item.py b/src/webflow/resources/collections/resources/items/types/create_bulk_collection_item_request_body_field_data_item.py new file mode 100644 index 0000000..0976e8e --- /dev/null +++ b/src/webflow/resources/collections/resources/items/types/create_bulk_collection_item_request_body_field_data_item.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ......core.datetime_utils import serialize_datetime +from ......core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 + + +class CreateBulkCollectionItemRequestBodyFieldDataItem(pydantic_v1.BaseModel): + """ + A single CMS item to create + """ + + name: str = pydantic_v1.Field() + """ + The name of the item. + """ + + slug: str = pydantic_v1.Field() + """ + URL slug for the item in your site. + Note: Updating the item slug will break all links referencing the old slug. + """ + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} + + return deep_union_pydantic_dicts( + super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) + ) + + class Config: + frozen = True + smart_union = True + extra = pydantic_v1.Extra.allow + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/webflow/resources/collections/resources/items/types/items_create_item_live_request.py b/src/webflow/resources/collections/resources/items/types/items_create_item_live_request.py new file mode 100644 index 0000000..ad9ab6d --- /dev/null +++ b/src/webflow/resources/collections/resources/items/types/items_create_item_live_request.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ......types.collection_item import CollectionItem +from .multiple_live_items import MultipleLiveItems + +ItemsCreateItemLiveRequest = typing.Union[CollectionItem, MultipleLiveItems] diff --git a/src/webflow/resources/collections/resources/items/types/items_create_item_request.py b/src/webflow/resources/collections/resources/items/types/items_create_item_request.py new file mode 100644 index 0000000..b67128d --- /dev/null +++ b/src/webflow/resources/collections/resources/items/types/items_create_item_request.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ......types.collection_item_post_single import CollectionItemPostSingle +from .multiple_items import MultipleItems + +ItemsCreateItemRequest = typing.Union[CollectionItemPostSingle, MultipleItems] diff --git a/src/webflow/resources/collections/resources/items/types/items_delete_items_live_request_items_item.py b/src/webflow/resources/collections/resources/items/types/items_delete_items_live_request_items_item.py new file mode 100644 index 0000000..50c81dd --- /dev/null +++ b/src/webflow/resources/collections/resources/items/types/items_delete_items_live_request_items_item.py @@ -0,0 +1,39 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ......core.datetime_utils import serialize_datetime +from ......core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 + + +class ItemsDeleteItemsLiveRequestItemsItem(pydantic_v1.BaseModel): + item_id: str = pydantic_v1.Field(alias="itemId") + """ + Unique identifier for the Item + """ + + cms_locale_ids: typing.Optional[typing.List[str]] = pydantic_v1.Field(alias="cmsLocaleIds", default=None) + """ + Array of identifiers for the locales where the item will be created + """ + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} + + return deep_union_pydantic_dicts( + super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) + ) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + populate_by_name = True + extra = pydantic_v1.Extra.allow + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/webflow/resources/collections/resources/items/types/items_delete_items_request_items_item.py b/src/webflow/resources/collections/resources/items/types/items_delete_items_request_items_item.py new file mode 100644 index 0000000..42cc91a --- /dev/null +++ b/src/webflow/resources/collections/resources/items/types/items_delete_items_request_items_item.py @@ -0,0 +1,39 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ......core.datetime_utils import serialize_datetime +from ......core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 + + +class ItemsDeleteItemsRequestItemsItem(pydantic_v1.BaseModel): + id: str = pydantic_v1.Field() + """ + Unique identifier for the Item + """ + + cms_locale_ids: typing.Optional[typing.List[str]] = pydantic_v1.Field(alias="cmsLocaleIds", default=None) + """ + Array of identifiers for the locales where the item will be created + """ + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} + + return deep_union_pydantic_dicts( + super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) + ) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + populate_by_name = True + extra = pydantic_v1.Extra.allow + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/webflow/resources/collections/resources/items/types/items_publish_item_response.py b/src/webflow/resources/collections/resources/items/types/items_publish_item_response.py new file mode 100644 index 0000000..ffe496f --- /dev/null +++ b/src/webflow/resources/collections/resources/items/types/items_publish_item_response.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ......core.datetime_utils import serialize_datetime +from ......core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 + + +class ItemsPublishItemResponse(pydantic_v1.BaseModel): + published_item_ids: typing.Optional[typing.List[str]] = pydantic_v1.Field(alias="publishedItemIds", default=None) + errors: typing.Optional[typing.List[str]] = None + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} + + return deep_union_pydantic_dicts( + super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) + ) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + populate_by_name = True + extra = pydantic_v1.Extra.allow + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/webflow/resources/collections/resources/items/types/multiple_items.py b/src/webflow/resources/collections/resources/items/types/multiple_items.py new file mode 100644 index 0000000..9e6434a --- /dev/null +++ b/src/webflow/resources/collections/resources/items/types/multiple_items.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ......core.datetime_utils import serialize_datetime +from ......core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 +from ......types.collection_item_post_single import CollectionItemPostSingle + + +class MultipleItems(pydantic_v1.BaseModel): + items: typing.Optional[typing.List[CollectionItemPostSingle]] = pydantic_v1.Field(default=None) + """ + An array of items to create + """ + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} + + return deep_union_pydantic_dicts( + super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) + ) + + class Config: + frozen = True + smart_union = True + extra = pydantic_v1.Extra.allow + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/webflow/resources/collections/resources/items/types/multiple_live_items.py b/src/webflow/resources/collections/resources/items/types/multiple_live_items.py new file mode 100644 index 0000000..6438229 --- /dev/null +++ b/src/webflow/resources/collections/resources/items/types/multiple_live_items.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ......core.datetime_utils import serialize_datetime +from ......core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 +from ......types.collection_item import CollectionItem + + +class MultipleLiveItems(pydantic_v1.BaseModel): + items: typing.Optional[typing.List[CollectionItem]] = pydantic_v1.Field(default=None) + """ + List of collection items to create + """ + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} + + return deep_union_pydantic_dicts( + super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) + ) + + class Config: + frozen = True + smart_union = True + extra = pydantic_v1.Extra.allow + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/webflow/resources/collections/resources/items/types/single_cms_item.py b/src/webflow/resources/collections/resources/items/types/single_cms_item.py new file mode 100644 index 0000000..a4c3795 --- /dev/null +++ b/src/webflow/resources/collections/resources/items/types/single_cms_item.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ......core.datetime_utils import serialize_datetime +from ......core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 + + +class SingleCmsItem(pydantic_v1.BaseModel): + name: str = pydantic_v1.Field() + """ + The name of the item. + """ + + slug: str = pydantic_v1.Field() + """ + URL slug for the item in your site. + Note: Updating the item slug will break all links referencing the old slug. + """ + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} + + return deep_union_pydantic_dicts( + super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) + ) + + class Config: + frozen = True + smart_union = True + extra = pydantic_v1.Extra.allow + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/webflow/resources/ecommerce/client.py b/src/webflow/resources/ecommerce/client.py index 3baa775..2b5f7de 100644 --- a/src/webflow/resources/ecommerce/client.py +++ b/src/webflow/resources/ecommerce/client.py @@ -16,6 +16,7 @@ from ...errors.too_many_requests_error import TooManyRequestsError from ...errors.unauthorized_error import UnauthorizedError from ...types.ecommerce_settings import EcommerceSettings +from ...types.error import Error class EcommerceClient: @@ -51,7 +52,7 @@ def get_settings( access_token="YOUR_ACCESS_TOKEN", ) client.ecommerce.get_settings( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = self._client_wrapper.httpx_client.request( @@ -63,17 +64,17 @@ def get_settings( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -113,7 +114,7 @@ async def get_settings( access_token="YOUR_ACCESS_TOKEN", ) await client.ecommerce.get_settings( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -125,17 +126,17 @@ async def get_settings( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) diff --git a/src/webflow/resources/forms/client.py b/src/webflow/resources/forms/client.py index d5a86a0..b58f73f 100644 --- a/src/webflow/resources/forms/client.py +++ b/src/webflow/resources/forms/client.py @@ -15,6 +15,7 @@ from ...errors.not_found_error import NotFoundError from ...errors.too_many_requests_error import TooManyRequestsError from ...errors.unauthorized_error import UnauthorizedError +from ...types.error import Error from ...types.form import Form from ...types.form_list import FormList from ...types.form_submission import FormSubmission @@ -37,7 +38,9 @@ def list( request_options: typing.Optional[RequestOptions] = None, ) -> FormList: """ - List forms for a given site

Required scope | `forms:read` + List forms for a given site. + + Required scope | `forms:read` Parameters ---------- @@ -66,7 +69,7 @@ def list( access_token="YOUR_ACCESS_TOKEN", ) client.forms.list( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = self._client_wrapper.httpx_client.request( @@ -81,17 +84,17 @@ def list( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -99,7 +102,9 @@ def list( def get(self, form_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Form: """ - Get information about a given form

Required scope | `forms:read` + Get information about a given form. + + Required scope | `forms:read` Parameters ---------- @@ -122,7 +127,7 @@ def get(self, form_id: str, *, request_options: typing.Optional[RequestOptions] access_token="YOUR_ACCESS_TOKEN", ) client.forms.get( - form_id="form_id", + form_id="580e63e98c9a982ac9b8b741", ) """ _response = self._client_wrapper.httpx_client.request( @@ -134,31 +139,44 @@ def get(self, form_id: str, *, request_options: typing.Optional[RequestOptions] if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) def list_submissions( - self, form_id: str, *, request_options: typing.Optional[RequestOptions] = None + self, + form_id: str, + *, + offset: typing.Optional[float] = None, + limit: typing.Optional[float] = None, + request_options: typing.Optional[RequestOptions] = None, ) -> FormSubmissionList: """ - List form submissions for a given form

Required scope | `forms:read` + List form submissions for a given form + + Required scope | `forms:read` Parameters ---------- form_id : str Unique identifier for a Form + offset : typing.Optional[float] + Offset used for pagination if the results have more than limit records + + limit : typing.Optional[float] + Maximum number of records to be returned (max limit: 100) + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -175,11 +193,14 @@ def list_submissions( access_token="YOUR_ACCESS_TOKEN", ) client.forms.list_submissions( - form_id="form_id", + form_id="580e63e98c9a982ac9b8b741", ) """ _response = self._client_wrapper.httpx_client.request( - f"forms/{jsonable_encoder(form_id)}/submissions", method="GET", request_options=request_options + f"forms/{jsonable_encoder(form_id)}/submissions", + method="GET", + params={"offset": offset, "limit": limit}, + request_options=request_options, ) try: if 200 <= _response.status_code < 300: @@ -187,15 +208,15 @@ def list_submissions( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -205,7 +226,9 @@ def get_submission( self, form_submission_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> FormSubmission: """ - Get information about a given form submission

Required scope | `forms:read` + Get information about a given form submissio. + + Required scope | `forms:read` Parameters ---------- @@ -228,7 +251,7 @@ def get_submission( access_token="YOUR_ACCESS_TOKEN", ) client.forms.get_submission( - form_submission_id="form_submission_id", + form_submission_id="580e63e98c9a982ac9b8b741", ) """ _response = self._client_wrapper.httpx_client.request( @@ -240,15 +263,15 @@ def get_submission( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -262,7 +285,9 @@ def update_submission( request_options: typing.Optional[RequestOptions] = None, ) -> FormSubmission: """ - Update hidden fields on a form submission

Required scope | `forms:write` + Update hidden fields on a form submission + + Required scope | `forms:write` Parameters ---------- @@ -288,7 +313,7 @@ def update_submission( access_token="YOUR_ACCESS_TOKEN", ) client.forms.update_submission( - form_submission_id="form_submission_id", + form_submission_id="580e63e98c9a982ac9b8b741", ) """ _response = self._client_wrapper.httpx_client.request( @@ -304,17 +329,17 @@ def update_submission( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -334,7 +359,9 @@ async def list( request_options: typing.Optional[RequestOptions] = None, ) -> FormList: """ - List forms for a given site

Required scope | `forms:read` + List forms for a given site. + + Required scope | `forms:read` Parameters ---------- @@ -363,7 +390,7 @@ async def list( access_token="YOUR_ACCESS_TOKEN", ) await client.forms.list( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -378,17 +405,17 @@ async def list( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -396,7 +423,9 @@ async def list( async def get(self, form_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Form: """ - Get information about a given form

Required scope | `forms:read` + Get information about a given form. + + Required scope | `forms:read` Parameters ---------- @@ -419,7 +448,7 @@ async def get(self, form_id: str, *, request_options: typing.Optional[RequestOpt access_token="YOUR_ACCESS_TOKEN", ) await client.forms.get( - form_id="form_id", + form_id="580e63e98c9a982ac9b8b741", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -431,31 +460,44 @@ async def get(self, form_id: str, *, request_options: typing.Optional[RequestOpt if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) async def list_submissions( - self, form_id: str, *, request_options: typing.Optional[RequestOptions] = None + self, + form_id: str, + *, + offset: typing.Optional[float] = None, + limit: typing.Optional[float] = None, + request_options: typing.Optional[RequestOptions] = None, ) -> FormSubmissionList: """ - List form submissions for a given form

Required scope | `forms:read` + List form submissions for a given form + + Required scope | `forms:read` Parameters ---------- form_id : str Unique identifier for a Form + offset : typing.Optional[float] + Offset used for pagination if the results have more than limit records + + limit : typing.Optional[float] + Maximum number of records to be returned (max limit: 100) + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -472,11 +514,14 @@ async def list_submissions( access_token="YOUR_ACCESS_TOKEN", ) await client.forms.list_submissions( - form_id="form_id", + form_id="580e63e98c9a982ac9b8b741", ) """ _response = await self._client_wrapper.httpx_client.request( - f"forms/{jsonable_encoder(form_id)}/submissions", method="GET", request_options=request_options + f"forms/{jsonable_encoder(form_id)}/submissions", + method="GET", + params={"offset": offset, "limit": limit}, + request_options=request_options, ) try: if 200 <= _response.status_code < 300: @@ -484,15 +529,15 @@ async def list_submissions( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -502,7 +547,9 @@ async def get_submission( self, form_submission_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> FormSubmission: """ - Get information about a given form submission

Required scope | `forms:read` + Get information about a given form submissio. + + Required scope | `forms:read` Parameters ---------- @@ -525,7 +572,7 @@ async def get_submission( access_token="YOUR_ACCESS_TOKEN", ) await client.forms.get_submission( - form_submission_id="form_submission_id", + form_submission_id="580e63e98c9a982ac9b8b741", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -537,15 +584,15 @@ async def get_submission( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -559,7 +606,9 @@ async def update_submission( request_options: typing.Optional[RequestOptions] = None, ) -> FormSubmission: """ - Update hidden fields on a form submission

Required scope | `forms:write` + Update hidden fields on a form submission + + Required scope | `forms:write` Parameters ---------- @@ -585,7 +634,7 @@ async def update_submission( access_token="YOUR_ACCESS_TOKEN", ) await client.forms.update_submission( - form_submission_id="form_submission_id", + form_submission_id="580e63e98c9a982ac9b8b741", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -601,17 +650,17 @@ async def update_submission( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) diff --git a/src/webflow/resources/inventory/client.py b/src/webflow/resources/inventory/client.py index 44e16ea..687b97d 100644 --- a/src/webflow/resources/inventory/client.py +++ b/src/webflow/resources/inventory/client.py @@ -15,6 +15,7 @@ from ...errors.not_found_error import NotFoundError from ...errors.too_many_requests_error import TooManyRequestsError from ...errors.unauthorized_error import UnauthorizedError +from ...types.error import Error from ...types.inventory_item import InventoryItem from .types.inventory_update_request_inventory_type import InventoryUpdateRequestInventoryType @@ -58,8 +59,8 @@ def list( access_token="YOUR_ACCESS_TOKEN", ) client.inventory.list( - collection_id="collection_id", - item_id="item_id", + collection_id="580e63fc8c9a982ac9b8b745", + item_id="580e64008c9a982ac9b8b754", ) """ _response = self._client_wrapper.httpx_client.request( @@ -73,17 +74,17 @@ def list( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -100,7 +101,12 @@ def update( request_options: typing.Optional[RequestOptions] = None, ) -> InventoryItem: """ - Updates the current inventory levels for a particular SKU item. Updates may be given in one or two methods, absolutely or incrementally. Absolute updates are done by setting `quantity` directly. Incremental updates are by specifying the inventory delta in `updateQuantity` which is then added to the `quantity` stored on the server. + Updates the current inventory levels for a particular SKU item. + + Updates may be given in one or two methods, absolutely or incrementally. + + - Absolute updates are done by setting `quantity` directly. + - Incremental updates are by specifying the inventory delta in `updateQuantity` which is then added to the `quantity` stored on the server. Required scope | `ecommerce:write` @@ -138,8 +144,8 @@ def update( access_token="YOUR_ACCESS_TOKEN", ) client.inventory.update( - collection_id="collection_id", - item_id="item_id", + collection_id="580e63fc8c9a982ac9b8b745", + item_id="580e64008c9a982ac9b8b754", inventory_type=InventoryUpdateRequestInventoryType.INFINITE, ) """ @@ -156,17 +162,17 @@ def update( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -209,8 +215,8 @@ async def list( access_token="YOUR_ACCESS_TOKEN", ) await client.inventory.list( - collection_id="collection_id", - item_id="item_id", + collection_id="580e63fc8c9a982ac9b8b745", + item_id="580e64008c9a982ac9b8b754", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -224,17 +230,17 @@ async def list( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -251,7 +257,12 @@ async def update( request_options: typing.Optional[RequestOptions] = None, ) -> InventoryItem: """ - Updates the current inventory levels for a particular SKU item. Updates may be given in one or two methods, absolutely or incrementally. Absolute updates are done by setting `quantity` directly. Incremental updates are by specifying the inventory delta in `updateQuantity` which is then added to the `quantity` stored on the server. + Updates the current inventory levels for a particular SKU item. + + Updates may be given in one or two methods, absolutely or incrementally. + + - Absolute updates are done by setting `quantity` directly. + - Incremental updates are by specifying the inventory delta in `updateQuantity` which is then added to the `quantity` stored on the server. Required scope | `ecommerce:write` @@ -289,8 +300,8 @@ async def update( access_token="YOUR_ACCESS_TOKEN", ) await client.inventory.update( - collection_id="collection_id", - item_id="item_id", + collection_id="580e63fc8c9a982ac9b8b745", + item_id="580e64008c9a982ac9b8b754", inventory_type=InventoryUpdateRequestInventoryType.INFINITE, ) """ @@ -307,17 +318,17 @@ async def update( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) diff --git a/src/webflow/resources/orders/client.py b/src/webflow/resources/orders/client.py index 21dc5e8..8e6d8db 100644 --- a/src/webflow/resources/orders/client.py +++ b/src/webflow/resources/orders/client.py @@ -15,6 +15,7 @@ from ...errors.not_found_error import NotFoundError from ...errors.too_many_requests_error import TooManyRequestsError from ...errors.unauthorized_error import UnauthorizedError +from ...types.error import Error from ...types.order import Order from ...types.order_list import OrderList from .types.orders_list_request_status import OrdersListRequestStatus @@ -72,7 +73,7 @@ def list( access_token="YOUR_ACCESS_TOKEN", ) client.orders.list( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = self._client_wrapper.httpx_client.request( @@ -87,17 +88,17 @@ def list( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -105,7 +106,8 @@ def list( def get(self, site_id: str, order_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Order: """ - Retrieve a single product by its id. All of its SKUs will also be retrieved. + Retrieve a single product by its ID. All of its SKUs will also be + retrieved. Required scope | `ecommerce:read` @@ -133,8 +135,8 @@ def get(self, site_id: str, order_id: str, *, request_options: typing.Optional[R access_token="YOUR_ACCESS_TOKEN", ) client.orders.get( - site_id="site_id", - order_id="order_id", + site_id="580e63e98c9a982ac9b8b741", + order_id="5e8518516e147040726cc415", ) """ _response = self._client_wrapper.httpx_client.request( @@ -148,17 +150,17 @@ def get(self, site_id: str, order_id: str, *, request_options: typing.Optional[R if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -176,7 +178,9 @@ def update( request_options: typing.Optional[RequestOptions] = None, ) -> Order: """ - This API lets you update the fields, `comment`, `shippingProvider`, and/or `shippingTracking` for a given order. All three fields can be updated simultaneously or independently. + This API lets you update the fields, `comment`, `shippingProvider`, + and/or `shippingTracking` for a given order. All three fields can be + updated simultaneously or independently. Required scope | `ecommerce:write` @@ -216,8 +220,8 @@ def update( access_token="YOUR_ACCESS_TOKEN", ) client.orders.update( - site_id="site_id", - order_id="order_id", + site_id="580e63e98c9a982ac9b8b741", + order_id="5e8518516e147040726cc415", ) """ _response = self._client_wrapper.httpx_client.request( @@ -238,17 +242,17 @@ def update( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -294,8 +298,8 @@ def update_fulfill( access_token="YOUR_ACCESS_TOKEN", ) client.orders.update_fulfill( - site_id="site_id", - order_id="order_id", + site_id="580e63e98c9a982ac9b8b741", + order_id="5e8518516e147040726cc415", ) """ _response = self._client_wrapper.httpx_client.request( @@ -311,17 +315,17 @@ def update_fulfill( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -359,8 +363,8 @@ def update_unfulfill( access_token="YOUR_ACCESS_TOKEN", ) client.orders.update_unfulfill( - site_id="site_id", - order_id="order_id", + site_id="580e63e98c9a982ac9b8b741", + order_id="5e8518516e147040726cc415", ) """ _response = self._client_wrapper.httpx_client.request( @@ -374,17 +378,17 @@ def update_unfulfill( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -431,8 +435,8 @@ def refund( access_token="YOUR_ACCESS_TOKEN", ) client.orders.refund( - site_id="site_id", - order_id="order_id", + site_id="580e63e98c9a982ac9b8b741", + order_id="5e8518516e147040726cc415", ) """ _response = self._client_wrapper.httpx_client.request( @@ -448,17 +452,17 @@ def refund( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -513,7 +517,7 @@ async def list( access_token="YOUR_ACCESS_TOKEN", ) await client.orders.list( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -528,17 +532,17 @@ async def list( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -548,7 +552,8 @@ async def get( self, site_id: str, order_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> Order: """ - Retrieve a single product by its id. All of its SKUs will also be retrieved. + Retrieve a single product by its ID. All of its SKUs will also be + retrieved. Required scope | `ecommerce:read` @@ -576,8 +581,8 @@ async def get( access_token="YOUR_ACCESS_TOKEN", ) await client.orders.get( - site_id="site_id", - order_id="order_id", + site_id="580e63e98c9a982ac9b8b741", + order_id="5e8518516e147040726cc415", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -591,17 +596,17 @@ async def get( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -619,7 +624,9 @@ async def update( request_options: typing.Optional[RequestOptions] = None, ) -> Order: """ - This API lets you update the fields, `comment`, `shippingProvider`, and/or `shippingTracking` for a given order. All three fields can be updated simultaneously or independently. + This API lets you update the fields, `comment`, `shippingProvider`, + and/or `shippingTracking` for a given order. All three fields can be + updated simultaneously or independently. Required scope | `ecommerce:write` @@ -659,8 +666,8 @@ async def update( access_token="YOUR_ACCESS_TOKEN", ) await client.orders.update( - site_id="site_id", - order_id="order_id", + site_id="580e63e98c9a982ac9b8b741", + order_id="5e8518516e147040726cc415", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -681,17 +688,17 @@ async def update( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -737,8 +744,8 @@ async def update_fulfill( access_token="YOUR_ACCESS_TOKEN", ) await client.orders.update_fulfill( - site_id="site_id", - order_id="order_id", + site_id="580e63e98c9a982ac9b8b741", + order_id="5e8518516e147040726cc415", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -754,17 +761,17 @@ async def update_fulfill( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -802,8 +809,8 @@ async def update_unfulfill( access_token="YOUR_ACCESS_TOKEN", ) await client.orders.update_unfulfill( - site_id="site_id", - order_id="order_id", + site_id="580e63e98c9a982ac9b8b741", + order_id="5e8518516e147040726cc415", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -817,17 +824,17 @@ async def update_unfulfill( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -874,8 +881,8 @@ async def refund( access_token="YOUR_ACCESS_TOKEN", ) await client.orders.refund( - site_id="site_id", - order_id="order_id", + site_id="580e63e98c9a982ac9b8b741", + order_id="5e8518516e147040726cc415", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -891,17 +898,17 @@ async def refund( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) diff --git a/src/webflow/resources/pages/client.py b/src/webflow/resources/pages/client.py index 61c1550..aa06084 100644 --- a/src/webflow/resources/pages/client.py +++ b/src/webflow/resources/pages/client.py @@ -16,7 +16,8 @@ from ...errors.too_many_requests_error import TooManyRequestsError from ...errors.unauthorized_error import UnauthorizedError from ...types.dom import Dom -from ...types.page_details import PageDetails +from ...types.error import Error +from ...types.page import Page from ...types.page_list import PageList from ...types.page_open_graph import PageOpenGraph from ...types.page_seo import PageSeo @@ -37,20 +38,22 @@ def list( self, site_id: str, *, - locale: typing.Optional[str] = None, + locale_id: typing.Optional[str] = None, limit: typing.Optional[float] = None, offset: typing.Optional[float] = None, request_options: typing.Optional[RequestOptions] = None, ) -> PageList: """ - List of all pages for a site

Required scope | `pages:read` + List of all pages for a site. + + Required scope | `pages:read` Parameters ---------- site_id : str Unique identifier for a Site - locale : typing.Optional[str] + locale_id : typing.Optional[str] Unique identifier for a specific locale. Applicable, when using localization. limit : typing.Optional[float] @@ -75,13 +78,14 @@ def list( access_token="YOUR_ACCESS_TOKEN", ) client.pages.list( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", + locale_id="65427cf400e02b306eaa04a0", ) """ _response = self._client_wrapper.httpx_client.request( f"sites/{jsonable_encoder(site_id)}/pages", method="GET", - params={"locale": locale, "limit": limit, "offset": offset}, + params={"localeId": locale_id, "limit": limit, "offset": offset}, request_options=request_options, ) try: @@ -90,13 +94,13 @@ def list( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -106,18 +110,20 @@ def get_metadata( self, page_id: str, *, - locale: typing.Optional[str] = None, + locale_id: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None, - ) -> PageDetails: + ) -> Page: """ - Get metadata information for a single page

Required scope | `pages:read` + Get metadata information for a single page. + + Required scope | `pages:read` Parameters ---------- page_id : str Unique identifier for a Page - locale : typing.Optional[str] + locale_id : typing.Optional[str] Unique identifier for a specific locale. Applicable, when using localization. request_options : typing.Optional[RequestOptions] @@ -125,7 +131,7 @@ def get_metadata( Returns ------- - PageDetails + Page Request was successful Examples @@ -136,28 +142,29 @@ def get_metadata( access_token="YOUR_ACCESS_TOKEN", ) client.pages.get_metadata( - page_id="page_id", + page_id="63c720f9347c2139b248e552", + locale_id="65427cf400e02b306eaa04a0", ) """ _response = self._client_wrapper.httpx_client.request( f"pages/{jsonable_encoder(page_id)}", method="GET", - params={"locale": locale}, + params={"localeId": locale_id}, request_options=request_options, ) try: if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(PageDetails, _response.json()) # type: ignore + return pydantic_v1.parse_obj_as(Page, _response.json()) # type: ignore if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -167,8 +174,8 @@ def update_page_settings( self, page_id: str, *, - locale: typing.Optional[str] = None, - id: typing.Optional[str] = OMIT, + id: str, + locale_id: typing.Optional[str] = None, site_id: typing.Optional[str] = OMIT, title: typing.Optional[str] = OMIT, slug: typing.Optional[str] = OMIT, @@ -179,25 +186,30 @@ def update_page_settings( archived: typing.Optional[bool] = OMIT, draft: typing.Optional[bool] = OMIT, can_branch: typing.Optional[bool] = OMIT, + is_branch: typing.Optional[bool] = OMIT, is_members_only: typing.Optional[bool] = OMIT, seo: typing.Optional[PageSeo] = OMIT, open_graph: typing.Optional[PageOpenGraph] = OMIT, + page_locale_id: typing.Optional[str] = OMIT, + published_path: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> PageDetails: + ) -> Page: """ - Update Page-level metadata, including SEO and Open Graph fields.

Required scope | `pages:write` + Update Page-level metadata, including SEO and Open Graph fields. + + Required scope | `pages:write` Parameters ---------- page_id : str Unique identifier for a Page - locale : typing.Optional[str] - Unique identifier for a specific locale. Applicable, when using localization. - - id : typing.Optional[str] + id : str Unique identifier for the Page + locale_id : typing.Optional[str] + Unique identifier for a specific locale. Applicable, when using localization. + site_id : typing.Optional[str] Unique identifier for the Site @@ -228,6 +240,9 @@ def update_page_settings( can_branch : typing.Optional[bool] Indicates whether the Page supports [Page Branching](https://university.webflow.com/lesson/page-branching) + is_branch : typing.Optional[bool] + Indicates whether the Page is a Branch of another Page [Page Branching](https://university.webflow.com/lesson/page-branching) + is_members_only : typing.Optional[bool] Indicates whether the Page is restricted by [Memberships Controls](https://university.webflow.com/lesson/webflow-memberships-overview#how-to-manage-page-restrictions) @@ -237,12 +252,18 @@ def update_page_settings( open_graph : typing.Optional[PageOpenGraph] Open Graph fields for the Page + page_locale_id : typing.Optional[str] + Unique ID of the page locale + + published_path : typing.Optional[str] + Relative path of the published page URL + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - PageDetails + Page Request was successful Examples @@ -256,13 +277,12 @@ def update_page_settings( access_token="YOUR_ACCESS_TOKEN", ) client.pages.update_page_settings( - page_id="page_id", + page_id="63c720f9347c2139b248e552", + locale_id="65427cf400e02b306eaa04a0", id="6596da6045e56dee495bcbba", site_id="6258612d1ee792848f805dcf", title="Guide to the Galaxy", slug="guide-to-the-galaxy", - parent_id="6419db964a9c435aa3af6251", - collection_id="6390c49774a71f12831a08e3", created_on=datetime.datetime.fromisoformat( "2024-03-11 10:42:00+00:00", ), @@ -272,6 +292,7 @@ def update_page_settings( archived=False, draft=False, can_branch=True, + is_branch=False, seo=PageSeo( title="The Ultimate Hitchhiker's Guide to the Galaxy", description="Everything you need to know about the galaxy, from avoiding Vogon poetry to the importance of towels.", @@ -282,12 +303,14 @@ def update_page_settings( description="Dive deep into the mysteries of the universe with your guide to everything galactic.", description_copied=False, ), + page_locale_id="653fd9af6a07fc9cfd7a5e57", + published_path="/en-us/guide-to-the-galaxy", ) """ _response = self._client_wrapper.httpx_client.request( f"pages/{jsonable_encoder(page_id)}", method="PUT", - params={"locale": locale}, + params={"localeId": locale_id}, json={ "id": id, "siteId": site_id, @@ -300,26 +323,29 @@ def update_page_settings( "archived": archived, "draft": draft, "canBranch": can_branch, + "isBranch": is_branch, "isMembersOnly": is_members_only, "seo": seo, "openGraph": open_graph, + "localeId": locale_id, + "publishedPath": published_path, }, request_options=request_options, omit=OMIT, ) try: if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(PageDetails, _response.json()) # type: ignore + return pydantic_v1.parse_obj_as(Page, _response.json()) # type: ignore if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -329,20 +355,24 @@ def get_content( self, page_id: str, *, - locale: typing.Optional[str] = None, + locale_id: typing.Optional[str] = None, limit: typing.Optional[float] = None, offset: typing.Optional[float] = None, request_options: typing.Optional[RequestOptions] = None, ) -> Dom: """ - Get static content from a static page.
If you do not provide a Locale ID in your request, the response will return any content that can be localized from the Primary locale

Required scope | `pages:read` + Get static content from a static page. + + If you do not provide a Locale ID in your request, the response will return any content that can be localized from the Primary locale. + + Required scope | `pages:read` Parameters ---------- page_id : str Unique identifier for a Page - locale : typing.Optional[str] + locale_id : typing.Optional[str] Unique identifier for a specific locale. Applicable, when using localization. limit : typing.Optional[float] @@ -367,13 +397,14 @@ def get_content( access_token="YOUR_ACCESS_TOKEN", ) client.pages.get_content( - page_id="page_id", + page_id="63c720f9347c2139b248e552", + locale_id="65427cf400e02b306eaa04a0", ) """ _response = self._client_wrapper.httpx_client.request( f"pages/{jsonable_encoder(page_id)}/dom", method="GET", - params={"locale": locale, "limit": limit, "offset": offset}, + params={"localeId": locale_id, "limit": limit, "offset": offset}, request_options=request_options, ) try: @@ -382,15 +413,15 @@ def get_content( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -400,23 +431,27 @@ def update_static_content( self, page_id: str, *, - locale: str, nodes: typing.Sequence[DomWriteNodesItem], + locale_id: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None, ) -> UpdateStaticContentResponse: """ - Update static content on a static page. This endpoint supports sending 1000 nodes per request.

Required scope | `pages:write` + This endpoint allows for updating static content on a static page within a secondary locale. It is designed specifically for localized pages and can handle up to 1000 nodes per request. + +

Note:This endpoint is specifically for localized pages. Ensure that the locale specified is a valid secondary locale for the site.

+ + Required scope | `pages:write` Parameters ---------- page_id : str Unique identifier for a Page - locale : str - The locale identifier. - nodes : typing.Sequence[DomWriteNodesItem] + locale_id : typing.Optional[str] + Unique identifier for a specific locale. Applicable, when using localization. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -434,20 +469,20 @@ def update_static_content( access_token="YOUR_ACCESS_TOKEN", ) client.pages.update_static_content( - page_id="page_id", - locale="locale", + page_id="63c720f9347c2139b248e552", + locale_id="65427cf400e02b306eaa04a0", nodes=[ DomWriteNodesItem( node_id="a245c12d-995b-55ee-5ec7-aa36a6cad623", - text="

The Hitchhiker's Guide to the Galaxy

", + text="

The Hitchhiker’s Guide to the Galaxy

", ), DomWriteNodesItem( node_id="a245c12d-995b-55ee-5ec7-aa36a6cad627", - text="

Don't Panic!

Always know where your towel is.

", + text="

Don’t Panic!

Always know where your towel is.

", ), DomWriteNodesItem( node_id="a245c12d-995b-55ee-5ec7-aa36a6cad629", - text="Marvin, the Paranoid Android", + text='Marvin, the Paranoid Android', ), ], ) @@ -455,7 +490,7 @@ def update_static_content( _response = self._client_wrapper.httpx_client.request( f"pages/{jsonable_encoder(page_id)}/dom", method="POST", - params={"locale": locale}, + params={"localeId": locale_id}, json={"nodes": nodes}, request_options=request_options, omit=OMIT, @@ -466,15 +501,15 @@ def update_static_content( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -490,20 +525,22 @@ async def list( self, site_id: str, *, - locale: typing.Optional[str] = None, + locale_id: typing.Optional[str] = None, limit: typing.Optional[float] = None, offset: typing.Optional[float] = None, request_options: typing.Optional[RequestOptions] = None, ) -> PageList: """ - List of all pages for a site

Required scope | `pages:read` + List of all pages for a site. + + Required scope | `pages:read` Parameters ---------- site_id : str Unique identifier for a Site - locale : typing.Optional[str] + locale_id : typing.Optional[str] Unique identifier for a specific locale. Applicable, when using localization. limit : typing.Optional[float] @@ -528,13 +565,14 @@ async def list( access_token="YOUR_ACCESS_TOKEN", ) await client.pages.list( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", + locale_id="65427cf400e02b306eaa04a0", ) """ _response = await self._client_wrapper.httpx_client.request( f"sites/{jsonable_encoder(site_id)}/pages", method="GET", - params={"locale": locale, "limit": limit, "offset": offset}, + params={"localeId": locale_id, "limit": limit, "offset": offset}, request_options=request_options, ) try: @@ -543,13 +581,13 @@ async def list( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -559,18 +597,20 @@ async def get_metadata( self, page_id: str, *, - locale: typing.Optional[str] = None, + locale_id: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None, - ) -> PageDetails: + ) -> Page: """ - Get metadata information for a single page

Required scope | `pages:read` + Get metadata information for a single page. + + Required scope | `pages:read` Parameters ---------- page_id : str Unique identifier for a Page - locale : typing.Optional[str] + locale_id : typing.Optional[str] Unique identifier for a specific locale. Applicable, when using localization. request_options : typing.Optional[RequestOptions] @@ -578,7 +618,7 @@ async def get_metadata( Returns ------- - PageDetails + Page Request was successful Examples @@ -589,28 +629,29 @@ async def get_metadata( access_token="YOUR_ACCESS_TOKEN", ) await client.pages.get_metadata( - page_id="page_id", + page_id="63c720f9347c2139b248e552", + locale_id="65427cf400e02b306eaa04a0", ) """ _response = await self._client_wrapper.httpx_client.request( f"pages/{jsonable_encoder(page_id)}", method="GET", - params={"locale": locale}, + params={"localeId": locale_id}, request_options=request_options, ) try: if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(PageDetails, _response.json()) # type: ignore + return pydantic_v1.parse_obj_as(Page, _response.json()) # type: ignore if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -620,8 +661,8 @@ async def update_page_settings( self, page_id: str, *, - locale: typing.Optional[str] = None, - id: typing.Optional[str] = OMIT, + id: str, + locale_id: typing.Optional[str] = None, site_id: typing.Optional[str] = OMIT, title: typing.Optional[str] = OMIT, slug: typing.Optional[str] = OMIT, @@ -632,25 +673,30 @@ async def update_page_settings( archived: typing.Optional[bool] = OMIT, draft: typing.Optional[bool] = OMIT, can_branch: typing.Optional[bool] = OMIT, + is_branch: typing.Optional[bool] = OMIT, is_members_only: typing.Optional[bool] = OMIT, seo: typing.Optional[PageSeo] = OMIT, open_graph: typing.Optional[PageOpenGraph] = OMIT, + page_locale_id: typing.Optional[str] = OMIT, + published_path: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> PageDetails: + ) -> Page: """ - Update Page-level metadata, including SEO and Open Graph fields.

Required scope | `pages:write` + Update Page-level metadata, including SEO and Open Graph fields. + + Required scope | `pages:write` Parameters ---------- page_id : str Unique identifier for a Page - locale : typing.Optional[str] - Unique identifier for a specific locale. Applicable, when using localization. - - id : typing.Optional[str] + id : str Unique identifier for the Page + locale_id : typing.Optional[str] + Unique identifier for a specific locale. Applicable, when using localization. + site_id : typing.Optional[str] Unique identifier for the Site @@ -681,6 +727,9 @@ async def update_page_settings( can_branch : typing.Optional[bool] Indicates whether the Page supports [Page Branching](https://university.webflow.com/lesson/page-branching) + is_branch : typing.Optional[bool] + Indicates whether the Page is a Branch of another Page [Page Branching](https://university.webflow.com/lesson/page-branching) + is_members_only : typing.Optional[bool] Indicates whether the Page is restricted by [Memberships Controls](https://university.webflow.com/lesson/webflow-memberships-overview#how-to-manage-page-restrictions) @@ -690,12 +739,18 @@ async def update_page_settings( open_graph : typing.Optional[PageOpenGraph] Open Graph fields for the Page + page_locale_id : typing.Optional[str] + Unique ID of the page locale + + published_path : typing.Optional[str] + Relative path of the published page URL + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - PageDetails + Page Request was successful Examples @@ -709,13 +764,12 @@ async def update_page_settings( access_token="YOUR_ACCESS_TOKEN", ) await client.pages.update_page_settings( - page_id="page_id", + page_id="63c720f9347c2139b248e552", + locale_id="65427cf400e02b306eaa04a0", id="6596da6045e56dee495bcbba", site_id="6258612d1ee792848f805dcf", title="Guide to the Galaxy", slug="guide-to-the-galaxy", - parent_id="6419db964a9c435aa3af6251", - collection_id="6390c49774a71f12831a08e3", created_on=datetime.datetime.fromisoformat( "2024-03-11 10:42:00+00:00", ), @@ -725,6 +779,7 @@ async def update_page_settings( archived=False, draft=False, can_branch=True, + is_branch=False, seo=PageSeo( title="The Ultimate Hitchhiker's Guide to the Galaxy", description="Everything you need to know about the galaxy, from avoiding Vogon poetry to the importance of towels.", @@ -735,12 +790,14 @@ async def update_page_settings( description="Dive deep into the mysteries of the universe with your guide to everything galactic.", description_copied=False, ), + page_locale_id="653fd9af6a07fc9cfd7a5e57", + published_path="/en-us/guide-to-the-galaxy", ) """ _response = await self._client_wrapper.httpx_client.request( f"pages/{jsonable_encoder(page_id)}", method="PUT", - params={"locale": locale}, + params={"localeId": locale_id}, json={ "id": id, "siteId": site_id, @@ -753,26 +810,29 @@ async def update_page_settings( "archived": archived, "draft": draft, "canBranch": can_branch, + "isBranch": is_branch, "isMembersOnly": is_members_only, "seo": seo, "openGraph": open_graph, + "localeId": locale_id, + "publishedPath": published_path, }, request_options=request_options, omit=OMIT, ) try: if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(PageDetails, _response.json()) # type: ignore + return pydantic_v1.parse_obj_as(Page, _response.json()) # type: ignore if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -782,20 +842,24 @@ async def get_content( self, page_id: str, *, - locale: typing.Optional[str] = None, + locale_id: typing.Optional[str] = None, limit: typing.Optional[float] = None, offset: typing.Optional[float] = None, request_options: typing.Optional[RequestOptions] = None, ) -> Dom: """ - Get static content from a static page.
If you do not provide a Locale ID in your request, the response will return any content that can be localized from the Primary locale

Required scope | `pages:read` + Get static content from a static page. + + If you do not provide a Locale ID in your request, the response will return any content that can be localized from the Primary locale. + + Required scope | `pages:read` Parameters ---------- page_id : str Unique identifier for a Page - locale : typing.Optional[str] + locale_id : typing.Optional[str] Unique identifier for a specific locale. Applicable, when using localization. limit : typing.Optional[float] @@ -820,13 +884,14 @@ async def get_content( access_token="YOUR_ACCESS_TOKEN", ) await client.pages.get_content( - page_id="page_id", + page_id="63c720f9347c2139b248e552", + locale_id="65427cf400e02b306eaa04a0", ) """ _response = await self._client_wrapper.httpx_client.request( f"pages/{jsonable_encoder(page_id)}/dom", method="GET", - params={"locale": locale, "limit": limit, "offset": offset}, + params={"localeId": locale_id, "limit": limit, "offset": offset}, request_options=request_options, ) try: @@ -835,15 +900,15 @@ async def get_content( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -853,23 +918,27 @@ async def update_static_content( self, page_id: str, *, - locale: str, nodes: typing.Sequence[DomWriteNodesItem], + locale_id: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None, ) -> UpdateStaticContentResponse: """ - Update static content on a static page. This endpoint supports sending 1000 nodes per request.

Required scope | `pages:write` + This endpoint allows for updating static content on a static page within a secondary locale. It is designed specifically for localized pages and can handle up to 1000 nodes per request. + +

Note:This endpoint is specifically for localized pages. Ensure that the locale specified is a valid secondary locale for the site.

+ + Required scope | `pages:write` Parameters ---------- page_id : str Unique identifier for a Page - locale : str - The locale identifier. - nodes : typing.Sequence[DomWriteNodesItem] + locale_id : typing.Optional[str] + Unique identifier for a specific locale. Applicable, when using localization. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -887,20 +956,20 @@ async def update_static_content( access_token="YOUR_ACCESS_TOKEN", ) await client.pages.update_static_content( - page_id="page_id", - locale="locale", + page_id="63c720f9347c2139b248e552", + locale_id="65427cf400e02b306eaa04a0", nodes=[ DomWriteNodesItem( node_id="a245c12d-995b-55ee-5ec7-aa36a6cad623", - text="

The Hitchhiker's Guide to the Galaxy

", + text="

The Hitchhiker’s Guide to the Galaxy

", ), DomWriteNodesItem( node_id="a245c12d-995b-55ee-5ec7-aa36a6cad627", - text="

Don't Panic!

Always know where your towel is.

", + text="

Don’t Panic!

Always know where your towel is.

", ), DomWriteNodesItem( node_id="a245c12d-995b-55ee-5ec7-aa36a6cad629", - text="Marvin, the Paranoid Android", + text='Marvin, the Paranoid Android', ), ], ) @@ -908,7 +977,7 @@ async def update_static_content( _response = await self._client_wrapper.httpx_client.request( f"pages/{jsonable_encoder(page_id)}/dom", method="POST", - params={"locale": locale}, + params={"localeId": locale_id}, json={"nodes": nodes}, request_options=request_options, omit=OMIT, @@ -919,15 +988,15 @@ async def update_static_content( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) diff --git a/src/webflow/resources/pages/resources/scripts/client.py b/src/webflow/resources/pages/resources/scripts/client.py index 1895650..7e991e7 100644 --- a/src/webflow/resources/pages/resources/scripts/client.py +++ b/src/webflow/resources/pages/resources/scripts/client.py @@ -13,6 +13,7 @@ from .....errors.not_found_error import NotFoundError from .....errors.too_many_requests_error import TooManyRequestsError from .....errors.unauthorized_error import UnauthorizedError +from .....types.error import Error from .....types.script_apply import ScriptApply from .....types.script_apply_list import ScriptApplyList @@ -28,7 +29,15 @@ def get_custom_code( self, page_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> ScriptApplyList: """ - Get all registered scripts that have been applied to a specific Page.

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints.
Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:read` + Get all registered scripts that have been applied to a specific Page. + + In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered + to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate + `custom_code` endpoints. + +
Access to this endpoint requires a bearer token from a Data Client App.
+ + Required scope | `custom_code:read` Parameters ---------- @@ -51,7 +60,7 @@ def get_custom_code( access_token="YOUR_ACCESS_TOKEN", ) client.pages.scripts.get_custom_code( - page_id="page_id", + page_id="63c720f9347c2139b248e552", ) """ _response = self._client_wrapper.httpx_client.request( @@ -63,13 +72,13 @@ def get_custom_code( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -85,7 +94,15 @@ def upsert_custom_code( request_options: typing.Optional[RequestOptions] = None, ) -> ScriptApplyList: """ - Add a registered script to a Page.

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints.
Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:write` + Add a registered script to a Page. + + In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered + to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate + `custom_code` endpoints. + +
Access to this endpoint requires a bearer token from a Data Client App.
+ + Required scope | `custom_code:write` Parameters ---------- @@ -118,7 +135,7 @@ def upsert_custom_code( access_token="YOUR_ACCESS_TOKEN", ) client.pages.scripts.upsert_custom_code( - page_id="page_id", + page_id="63c720f9347c2139b248e552", scripts=[ ScriptApply( id="cms_slider", @@ -147,13 +164,13 @@ def upsert_custom_code( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -161,7 +178,15 @@ def upsert_custom_code( def delete_custom_code(self, page_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: """ - Delete the custom code block that an app has created for a page

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints.
Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:write` + Delete the custom code block that an app has created for a page + + In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered + to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate + `custom_code` endpoints. + +
Access to this endpoint requires a bearer token from a Data Client App.
+ + Required scope | `custom_code:write` Parameters ---------- @@ -183,7 +208,7 @@ def delete_custom_code(self, page_id: str, *, request_options: typing.Optional[R access_token="YOUR_ACCESS_TOKEN", ) client.pages.scripts.delete_custom_code( - page_id="page_id", + page_id="63c720f9347c2139b248e552", ) """ _response = self._client_wrapper.httpx_client.request( @@ -195,13 +220,13 @@ def delete_custom_code(self, page_id: str, *, request_options: typing.Optional[R if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -216,7 +241,15 @@ async def get_custom_code( self, page_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> ScriptApplyList: """ - Get all registered scripts that have been applied to a specific Page.

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints.
Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:read` + Get all registered scripts that have been applied to a specific Page. + + In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered + to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate + `custom_code` endpoints. + +
Access to this endpoint requires a bearer token from a Data Client App.
+ + Required scope | `custom_code:read` Parameters ---------- @@ -239,7 +272,7 @@ async def get_custom_code( access_token="YOUR_ACCESS_TOKEN", ) await client.pages.scripts.get_custom_code( - page_id="page_id", + page_id="63c720f9347c2139b248e552", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -251,13 +284,13 @@ async def get_custom_code( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -273,7 +306,15 @@ async def upsert_custom_code( request_options: typing.Optional[RequestOptions] = None, ) -> ScriptApplyList: """ - Add a registered script to a Page.

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints.
Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:write` + Add a registered script to a Page. + + In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered + to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate + `custom_code` endpoints. + +
Access to this endpoint requires a bearer token from a Data Client App.
+ + Required scope | `custom_code:write` Parameters ---------- @@ -306,7 +347,7 @@ async def upsert_custom_code( access_token="YOUR_ACCESS_TOKEN", ) await client.pages.scripts.upsert_custom_code( - page_id="page_id", + page_id="63c720f9347c2139b248e552", scripts=[ ScriptApply( id="cms_slider", @@ -335,13 +376,13 @@ async def upsert_custom_code( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -351,7 +392,15 @@ async def delete_custom_code( self, page_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> None: """ - Delete the custom code block that an app has created for a page

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints.
Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:write` + Delete the custom code block that an app has created for a page + + In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered + to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate + `custom_code` endpoints. + +
Access to this endpoint requires a bearer token from a Data Client App.
+ + Required scope | `custom_code:write` Parameters ---------- @@ -373,7 +422,7 @@ async def delete_custom_code( access_token="YOUR_ACCESS_TOKEN", ) await client.pages.scripts.delete_custom_code( - page_id="page_id", + page_id="63c720f9347c2139b248e552", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -385,13 +434,13 @@ async def delete_custom_code( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) diff --git a/src/webflow/resources/products/client.py b/src/webflow/resources/products/client.py index fb1896e..a4081a8 100644 --- a/src/webflow/resources/products/client.py +++ b/src/webflow/resources/products/client.py @@ -15,6 +15,7 @@ from ...errors.not_found_error import NotFoundError from ...errors.too_many_requests_error import TooManyRequestsError from ...errors.unauthorized_error import UnauthorizedError +from ...types.error import Error from ...types.product import Product from ...types.product_and_sk_us import ProductAndSkUs from ...types.product_and_sk_us_list import ProductAndSkUsList @@ -39,7 +40,10 @@ def list( request_options: typing.Optional[RequestOptions] = None, ) -> ProductAndSkUsList: """ - Retrieve all products for a site. Use `limit` and `offset` to page through all products with subsequent requests. All SKUs for each product will also be fetched and returned. The `limit`, `offset` and `total` values represent Products only and do not include any SKUs. + Retrieve all products for a site. + + Use `limit` and `offset` to page through all products with subsequent requests. All SKUs for each product + will also be fetched and returned. The `limit`, `offset` and `total` values represent Products only and do not include any SKUs. Required scope | `ecommerce:read` @@ -70,7 +74,7 @@ def list( access_token="YOUR_ACCESS_TOKEN", ) client.products.list( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = self._client_wrapper.httpx_client.request( @@ -85,17 +89,17 @@ def list( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -111,13 +115,19 @@ def create( request_options: typing.Optional[RequestOptions] = None, ) -> ProductAndSkUs: """ - Creating a new Product involves creating both a Product and a SKU, since a Product Item has to have, at minimum, a single SKU. + Create a new product and SKU. + + When you create a product, you will always create a SKU, since a Product Item must have, at minimum, a single SKU. - In order to create a Product with multiple SKUs - for example a T-shirt in sizes small, medium and large - you'll need to create `sku-properties`. In our T-shirt example, a single `sku-property` would be Color. Within that property, we'll need to list out the various colors a T-shirt could be as an array of `enum` values: `royal-blue`, `crimson-red`, and `forrest-green`. + To create a Product with multiple SKUs - for example a T-shirt in sizes small, medium and large: - Once, you've created a Product and its `sku-properties` with `enum` values, you can create your default SKU, which will automatically be a combination of the first `sku-properties` you've created. In our example, the default SKU will be a Royal Blue T-Shirt, because our first `enum` of our Color `sku-property` is Royal Blue. After you've created your product, you can create additional SKUs using the Create SKU endpoint + - Create parameters in `sku-properties`, also known as [product options and variants.](https://help.webflow.com/hc/en-us/articles/33961334531347-Create-product-options-and-variants). + - A single `sku-property` would be `color`. Within the `color` property, list the various colors of T-shirts as an array of `enum` values: `royal-blue`, `crimson-red`, and `forrest-green`. + - Once, you've created a Product and its `sku-properties` with `enum` values, Webflow will create a **default SKU**, which will automatically be a combination of the first `sku-properties` you've created. + - In our example, the default SKU will be a Royal Blue T-Shirt, because our first `enum` of our Color `sku-property` is Royal Blue. + - After you've created your product, you can create additional SKUs using the [Create SKU endpoint.](/data/reference/ecommerce/products-sk-us/create-sku) - Upon creation, the default product type will be `Advanced`. The product type is used to determine which Product and SKU fields are shown to users in the `Designer` and the `Editor`. Setting it to `Advanced` ensures that all Product and SKU fields will be shown. + Upon creation, the default product type will be `Advanced`, which ensures all Product and SKU fields will be shown to users in the Designer. Required scope | `ecommerce:write` @@ -148,7 +158,7 @@ def create( access_token="YOUR_ACCESS_TOKEN", ) client.products.create( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = self._client_wrapper.httpx_client.request( @@ -164,17 +174,17 @@ def create( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -184,7 +194,8 @@ def get( self, site_id: str, product_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> ProductAndSkUs: """ - Retrieve a single product by its id. All of its SKUs will also be retrieved. + Retrieve a single product by its ID. All of its SKUs will also be + retrieved. Required scope | `ecommerce:read` @@ -212,8 +223,8 @@ def get( access_token="YOUR_ACCESS_TOKEN", ) client.products.get( - site_id="site_id", - product_id="product_id", + site_id="580e63e98c9a982ac9b8b741", + product_id="580e63fc8c9a982ac9b8b745", ) """ _response = self._client_wrapper.httpx_client.request( @@ -227,17 +238,17 @@ def get( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -254,7 +265,9 @@ def update( request_options: typing.Optional[RequestOptions] = None, ) -> Product: """ - Updating an existing Product will set the product type to `Advanced`. The product type is used to determine which Product and SKU fields are shown to users in the `Designer` and the `Editor`. Setting it to `Advanced` ensures that all Product and SKU fields will be shown. The product type can be edited in the `Designer` or the `Editor`. + Update an existing Product. + + Updating an existing Product will set the product type to `Advanced`, which ensures all Product and SKU fields will be shown to users in the Designer. Required scope | `ecommerce:write` @@ -288,8 +301,8 @@ def update( access_token="YOUR_ACCESS_TOKEN", ) client.products.update( - site_id="site_id", - product_id="product_id", + site_id="580e63e98c9a982ac9b8b741", + product_id="580e63fc8c9a982ac9b8b745", ) """ _response = self._client_wrapper.httpx_client.request( @@ -305,17 +318,17 @@ def update( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -331,9 +344,9 @@ def create_sku( request_options: typing.Optional[RequestOptions] = None, ) -> ProductsCreateSkuResponse: """ - Create additional SKUs to cover every variant of your Product. The Default SKU already counts as one of the variants. + Create additional SKUs to manage every [option and variant of your Product.](https://help.webflow.com/hc/en-us/articles/33961334531347-Create-product-options-and-variants) - Creating additional SKUs will set the product type to `Advanced` for the product associated with the SKUs. The product type is used to determine which Product and SKU fields are shown to users in the `Designer` and the `Editor`. Setting it to `Advanced` ensures that all Product and SKU fields will be shown. The product type can be edited in the `Designer` or the `Editor`. + Creating SKUs through the API will set the product type to `Advanced`, which ensures all Product and SKU fields will be shown to users in the Designer. Required scope | `ecommerce:write` @@ -367,8 +380,8 @@ def create_sku( access_token="YOUR_ACCESS_TOKEN", ) client.products.create_sku( - site_id="site_id", - product_id="product_id", + site_id="580e63e98c9a982ac9b8b741", + product_id="580e63fc8c9a982ac9b8b745", skus=[Sku()], ) """ @@ -385,17 +398,17 @@ def create_sku( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -412,7 +425,9 @@ def update_sku( request_options: typing.Optional[RequestOptions] = None, ) -> Sku: """ - Updating an existing SKU will set the product type to `Advanced` for the product associated with the SKU. The product type is used to determine which Product and SKU fields are shown to users in the `Designer` and the `Editor`. Setting it to `Advanced` ensures that all Product and SKU fields will be shown. The product type can be edited in the `Designer` or the `Editor`. + Update a specified SKU. + + Updating an existing SKU will set the Product type to `Advanced`, which ensures all Product and SKU fields will be shown to users in the Designer. Required scope | `ecommerce:write` @@ -448,9 +463,9 @@ def update_sku( access_token="YOUR_ACCESS_TOKEN", ) client.products.update_sku( - site_id="site_id", - product_id="product_id", - sku_id="sku_id", + site_id="580e63e98c9a982ac9b8b741", + product_id="580e63fc8c9a982ac9b8b745", + sku_id="5e8518516e147040726cc415", sku=Sku(), ) """ @@ -467,17 +482,17 @@ def update_sku( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -497,7 +512,10 @@ async def list( request_options: typing.Optional[RequestOptions] = None, ) -> ProductAndSkUsList: """ - Retrieve all products for a site. Use `limit` and `offset` to page through all products with subsequent requests. All SKUs for each product will also be fetched and returned. The `limit`, `offset` and `total` values represent Products only and do not include any SKUs. + Retrieve all products for a site. + + Use `limit` and `offset` to page through all products with subsequent requests. All SKUs for each product + will also be fetched and returned. The `limit`, `offset` and `total` values represent Products only and do not include any SKUs. Required scope | `ecommerce:read` @@ -528,7 +546,7 @@ async def list( access_token="YOUR_ACCESS_TOKEN", ) await client.products.list( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -543,17 +561,17 @@ async def list( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -569,13 +587,19 @@ async def create( request_options: typing.Optional[RequestOptions] = None, ) -> ProductAndSkUs: """ - Creating a new Product involves creating both a Product and a SKU, since a Product Item has to have, at minimum, a single SKU. + Create a new product and SKU. + + When you create a product, you will always create a SKU, since a Product Item must have, at minimum, a single SKU. - In order to create a Product with multiple SKUs - for example a T-shirt in sizes small, medium and large - you'll need to create `sku-properties`. In our T-shirt example, a single `sku-property` would be Color. Within that property, we'll need to list out the various colors a T-shirt could be as an array of `enum` values: `royal-blue`, `crimson-red`, and `forrest-green`. + To create a Product with multiple SKUs - for example a T-shirt in sizes small, medium and large: - Once, you've created a Product and its `sku-properties` with `enum` values, you can create your default SKU, which will automatically be a combination of the first `sku-properties` you've created. In our example, the default SKU will be a Royal Blue T-Shirt, because our first `enum` of our Color `sku-property` is Royal Blue. After you've created your product, you can create additional SKUs using the Create SKU endpoint + - Create parameters in `sku-properties`, also known as [product options and variants.](https://help.webflow.com/hc/en-us/articles/33961334531347-Create-product-options-and-variants). + - A single `sku-property` would be `color`. Within the `color` property, list the various colors of T-shirts as an array of `enum` values: `royal-blue`, `crimson-red`, and `forrest-green`. + - Once, you've created a Product and its `sku-properties` with `enum` values, Webflow will create a **default SKU**, which will automatically be a combination of the first `sku-properties` you've created. + - In our example, the default SKU will be a Royal Blue T-Shirt, because our first `enum` of our Color `sku-property` is Royal Blue. + - After you've created your product, you can create additional SKUs using the [Create SKU endpoint.](/data/reference/ecommerce/products-sk-us/create-sku) - Upon creation, the default product type will be `Advanced`. The product type is used to determine which Product and SKU fields are shown to users in the `Designer` and the `Editor`. Setting it to `Advanced` ensures that all Product and SKU fields will be shown. + Upon creation, the default product type will be `Advanced`, which ensures all Product and SKU fields will be shown to users in the Designer. Required scope | `ecommerce:write` @@ -606,7 +630,7 @@ async def create( access_token="YOUR_ACCESS_TOKEN", ) await client.products.create( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -622,17 +646,17 @@ async def create( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -642,7 +666,8 @@ async def get( self, site_id: str, product_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> ProductAndSkUs: """ - Retrieve a single product by its id. All of its SKUs will also be retrieved. + Retrieve a single product by its ID. All of its SKUs will also be + retrieved. Required scope | `ecommerce:read` @@ -670,8 +695,8 @@ async def get( access_token="YOUR_ACCESS_TOKEN", ) await client.products.get( - site_id="site_id", - product_id="product_id", + site_id="580e63e98c9a982ac9b8b741", + product_id="580e63fc8c9a982ac9b8b745", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -685,17 +710,17 @@ async def get( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -712,7 +737,9 @@ async def update( request_options: typing.Optional[RequestOptions] = None, ) -> Product: """ - Updating an existing Product will set the product type to `Advanced`. The product type is used to determine which Product and SKU fields are shown to users in the `Designer` and the `Editor`. Setting it to `Advanced` ensures that all Product and SKU fields will be shown. The product type can be edited in the `Designer` or the `Editor`. + Update an existing Product. + + Updating an existing Product will set the product type to `Advanced`, which ensures all Product and SKU fields will be shown to users in the Designer. Required scope | `ecommerce:write` @@ -746,8 +773,8 @@ async def update( access_token="YOUR_ACCESS_TOKEN", ) await client.products.update( - site_id="site_id", - product_id="product_id", + site_id="580e63e98c9a982ac9b8b741", + product_id="580e63fc8c9a982ac9b8b745", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -763,17 +790,17 @@ async def update( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -789,9 +816,9 @@ async def create_sku( request_options: typing.Optional[RequestOptions] = None, ) -> ProductsCreateSkuResponse: """ - Create additional SKUs to cover every variant of your Product. The Default SKU already counts as one of the variants. + Create additional SKUs to manage every [option and variant of your Product.](https://help.webflow.com/hc/en-us/articles/33961334531347-Create-product-options-and-variants) - Creating additional SKUs will set the product type to `Advanced` for the product associated with the SKUs. The product type is used to determine which Product and SKU fields are shown to users in the `Designer` and the `Editor`. Setting it to `Advanced` ensures that all Product and SKU fields will be shown. The product type can be edited in the `Designer` or the `Editor`. + Creating SKUs through the API will set the product type to `Advanced`, which ensures all Product and SKU fields will be shown to users in the Designer. Required scope | `ecommerce:write` @@ -825,8 +852,8 @@ async def create_sku( access_token="YOUR_ACCESS_TOKEN", ) await client.products.create_sku( - site_id="site_id", - product_id="product_id", + site_id="580e63e98c9a982ac9b8b741", + product_id="580e63fc8c9a982ac9b8b745", skus=[Sku()], ) """ @@ -843,17 +870,17 @@ async def create_sku( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -870,7 +897,9 @@ async def update_sku( request_options: typing.Optional[RequestOptions] = None, ) -> Sku: """ - Updating an existing SKU will set the product type to `Advanced` for the product associated with the SKU. The product type is used to determine which Product and SKU fields are shown to users in the `Designer` and the `Editor`. Setting it to `Advanced` ensures that all Product and SKU fields will be shown. The product type can be edited in the `Designer` or the `Editor`. + Update a specified SKU. + + Updating an existing SKU will set the Product type to `Advanced`, which ensures all Product and SKU fields will be shown to users in the Designer. Required scope | `ecommerce:write` @@ -906,9 +935,9 @@ async def update_sku( access_token="YOUR_ACCESS_TOKEN", ) await client.products.update_sku( - site_id="site_id", - product_id="product_id", - sku_id="sku_id", + site_id="580e63e98c9a982ac9b8b741", + product_id="580e63fc8c9a982ac9b8b745", + sku_id="5e8518516e147040726cc415", sku=Sku(), ) """ @@ -925,17 +954,17 @@ async def update_sku( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) diff --git a/src/webflow/resources/scripts/client.py b/src/webflow/resources/scripts/client.py index 473d57e..c592a78 100644 --- a/src/webflow/resources/scripts/client.py +++ b/src/webflow/resources/scripts/client.py @@ -15,6 +15,7 @@ from ...errors.unauthorized_error import UnauthorizedError from ...types.custom_code_hosted_response import CustomCodeHostedResponse from ...types.custom_code_inline_response import CustomCodeInlineResponse +from ...types.error import Error from ...types.registered_script_list import RegisteredScriptList # this is used as the default value for optional parameters @@ -27,7 +28,16 @@ def __init__(self, *, client_wrapper: SyncClientWrapper): def list(self, site_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> RegisteredScriptList: """ - List of scripts registered to a Site.

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints. Additionally, Scripts can be remotely hosted, or registered as inline snippets.
Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:read` + List of scripts registered to a Site. + + In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered + to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate + `custom_code` endpoints. + Additionally, Scripts can be remotely hosted, or registered as inline snippets. + +
Access to this endpoint requires a bearer token from a Data Client App.
+ + Required scope | `custom_code:read` Parameters ---------- @@ -50,7 +60,7 @@ def list(self, site_id: str, *, request_options: typing.Optional[RequestOptions] access_token="YOUR_ACCESS_TOKEN", ) client.scripts.list( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = self._client_wrapper.httpx_client.request( @@ -62,13 +72,13 @@ def list(self, site_id: str, *, request_options: typing.Optional[RequestOptions] if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -86,7 +96,16 @@ def register_hosted( request_options: typing.Optional[RequestOptions] = None, ) -> CustomCodeHostedResponse: """ - Add a script to a Site's Custom Code registry.

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints. Additionally, Scripts can be remotely hosted, or registered as inline snippets.
Access to this endpoint requires a bearer token from a Data Client App.


Required scope | `custom_code:write` + Add a script to a Site's Custom Code registry. + + In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered + to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate + `custom_code` endpoints. + Additionally, Scripts can be remotely hosted, or registered as inline snippets. + +
Access to this endpoint requires a bearer token from a Data Client App.
+ + Required scope | `custom_code:write` Parameters ---------- @@ -124,7 +143,7 @@ def register_hosted( access_token="YOUR_ACCESS_TOKEN", ) client.scripts.register_hosted( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", hosted_location="hostedLocation", integrity_hash="integrityHash", version="version", @@ -150,13 +169,13 @@ def register_hosted( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -174,7 +193,15 @@ def register_inline( request_options: typing.Optional[RequestOptions] = None, ) -> CustomCodeInlineResponse: """ - Add a script to a Site's Custom Code registry. Inline scripts can be between 1 and 2000 characters.

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints.

Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:write` + Add a script to a Site's Custom Code registry. Inline scripts can be between 1 and 2000 characters. + + In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered + to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate + `custom_code` endpoints. + +
Access to this endpoint requires a bearer token from a Data Client App.
+ + Required scope | `custom_code:write` Parameters ---------- @@ -212,7 +239,7 @@ def register_inline( access_token="YOUR_ACCESS_TOKEN", ) client.scripts.register_inline( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", source_code="alert('hello world');", version="0.0.1", display_name="Alert", @@ -237,13 +264,13 @@ def register_inline( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -258,7 +285,16 @@ async def list( self, site_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> RegisteredScriptList: """ - List of scripts registered to a Site.

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints. Additionally, Scripts can be remotely hosted, or registered as inline snippets.
Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:read` + List of scripts registered to a Site. + + In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered + to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate + `custom_code` endpoints. + Additionally, Scripts can be remotely hosted, or registered as inline snippets. + +
Access to this endpoint requires a bearer token from a Data Client App.
+ + Required scope | `custom_code:read` Parameters ---------- @@ -281,7 +317,7 @@ async def list( access_token="YOUR_ACCESS_TOKEN", ) await client.scripts.list( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -293,13 +329,13 @@ async def list( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -317,7 +353,16 @@ async def register_hosted( request_options: typing.Optional[RequestOptions] = None, ) -> CustomCodeHostedResponse: """ - Add a script to a Site's Custom Code registry.

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints. Additionally, Scripts can be remotely hosted, or registered as inline snippets.
Access to this endpoint requires a bearer token from a Data Client App.


Required scope | `custom_code:write` + Add a script to a Site's Custom Code registry. + + In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered + to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate + `custom_code` endpoints. + Additionally, Scripts can be remotely hosted, or registered as inline snippets. + +
Access to this endpoint requires a bearer token from a Data Client App.
+ + Required scope | `custom_code:write` Parameters ---------- @@ -355,7 +400,7 @@ async def register_hosted( access_token="YOUR_ACCESS_TOKEN", ) await client.scripts.register_hosted( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", hosted_location="hostedLocation", integrity_hash="integrityHash", version="version", @@ -381,13 +426,13 @@ async def register_hosted( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -405,7 +450,15 @@ async def register_inline( request_options: typing.Optional[RequestOptions] = None, ) -> CustomCodeInlineResponse: """ - Add a script to a Site's Custom Code registry. Inline scripts can be between 1 and 2000 characters.

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints.

Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:write` + Add a script to a Site's Custom Code registry. Inline scripts can be between 1 and 2000 characters. + + In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered + to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate + `custom_code` endpoints. + +
Access to this endpoint requires a bearer token from a Data Client App.
+ + Required scope | `custom_code:write` Parameters ---------- @@ -443,7 +496,7 @@ async def register_inline( access_token="YOUR_ACCESS_TOKEN", ) await client.scripts.register_inline( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", source_code="alert('hello world');", version="0.0.1", display_name="Alert", @@ -468,13 +521,13 @@ async def register_inline( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) diff --git a/src/webflow/resources/sites/__init__.py b/src/webflow/resources/sites/__init__.py index c4ea3e7..11370fc 100644 --- a/src/webflow/resources/sites/__init__.py +++ b/src/webflow/resources/sites/__init__.py @@ -1,5 +1,6 @@ # This file was auto-generated by Fern from our API Definition. +from .types import SitesPublishResponse from .resources import activity_logs, scripts -__all__ = ["activity_logs", "scripts"] +__all__ = ["SitesPublishResponse", "activity_logs", "scripts"] diff --git a/src/webflow/resources/sites/client.py b/src/webflow/resources/sites/client.py index 24b355d..7f82d86 100644 --- a/src/webflow/resources/sites/client.py +++ b/src/webflow/resources/sites/client.py @@ -15,10 +15,12 @@ from ...errors.too_many_requests_error import TooManyRequestsError from ...errors.unauthorized_error import UnauthorizedError from ...types.domains import Domains +from ...types.error import Error from ...types.site import Site from ...types.sites import Sites from .resources.activity_logs.client import ActivityLogsClient, AsyncActivityLogsClient from .resources.scripts.client import AsyncScriptsClient, ScriptsClient +from .types.sites_publish_response import SitesPublishResponse # this is used as the default value for optional parameters OMIT = typing.cast(typing.Any, ...) @@ -32,7 +34,9 @@ def __init__(self, *, client_wrapper: SyncClientWrapper): def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> Sites: """ - List of all sites the provided access token is able to access.

Required scope | `sites:read` + List of all sites the provided access token is able to access. + + Required scope | `sites:read` Parameters ---------- @@ -57,16 +61,12 @@ def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> Si try: if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(Sites, _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -74,7 +74,9 @@ def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> Si def get(self, site_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Site: """ - Get a site by site id

Required scope | `sites:read` + Get details of a site. + + Required scope | `sites:read` Parameters ---------- @@ -97,7 +99,7 @@ def get(self, site_id: str, *, request_options: typing.Optional[RequestOptions] access_token="YOUR_ACCESS_TOKEN", ) client.sites.get( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = self._client_wrapper.httpx_client.request( @@ -109,13 +111,13 @@ def get(self, site_id: str, *, request_options: typing.Optional[RequestOptions] if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -123,7 +125,9 @@ def get(self, site_id: str, *, request_options: typing.Optional[RequestOptions] def get_custom_domain(self, site_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Domains: """ - Get a list of all custom domains related to site.

Required scope | `sites:read` + Get a list of all custom domains related to site. + + Required scope | `sites:read` Parameters ---------- @@ -146,7 +150,7 @@ def get_custom_domain(self, site_id: str, *, request_options: typing.Optional[Re access_token="YOUR_ACCESS_TOKEN", ) client.sites.get_custom_domain( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = self._client_wrapper.httpx_client.request( @@ -156,15 +160,15 @@ def get_custom_domain(self, site_id: str, *, request_options: typing.Optional[Re if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(Domains, _response.json()) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -177,9 +181,13 @@ def publish( custom_domains: typing.Optional[typing.Sequence[str]] = OMIT, publish_to_webflow_subdomain: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> None: + ) -> SitesPublishResponse: """ - Publish a site to one more more domains.

Required scope | `sites:write` + Publishes a site to one or more more domains. + + This endpoint has a limit of one successful publish queue per minute. + + Required scope | `sites:write` Parameters ---------- @@ -187,7 +195,7 @@ def publish( Unique identifier for a Site custom_domains : typing.Optional[typing.Sequence[str]] - Array of Custom Domain ids to publish + Array of Custom Domain IDs to publish publish_to_webflow_subdomain : typing.Optional[bool] Choice of whether to publish to the default Webflow Subdomain @@ -197,7 +205,8 @@ def publish( Returns ------- - None + SitesPublishResponse + Request accepted Examples -------- @@ -207,7 +216,7 @@ def publish( access_token="YOUR_ACCESS_TOKEN", ) client.sites.publish( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = self._client_wrapper.httpx_client.request( @@ -219,17 +228,17 @@ def publish( ) try: if 200 <= _response.status_code < 300: - return + return pydantic_v1.parse_obj_as(SitesPublishResponse, _response.json()) # type: ignore if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -244,7 +253,9 @@ def __init__(self, *, client_wrapper: AsyncClientWrapper): async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> Sites: """ - List of all sites the provided access token is able to access.

Required scope | `sites:read` + List of all sites the provided access token is able to access. + + Required scope | `sites:read` Parameters ---------- @@ -271,16 +282,12 @@ async def list(self, *, request_options: typing.Optional[RequestOptions] = None) try: if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(Sites, _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -288,7 +295,9 @@ async def list(self, *, request_options: typing.Optional[RequestOptions] = None) async def get(self, site_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Site: """ - Get a site by site id

Required scope | `sites:read` + Get details of a site. + + Required scope | `sites:read` Parameters ---------- @@ -311,7 +320,7 @@ async def get(self, site_id: str, *, request_options: typing.Optional[RequestOpt access_token="YOUR_ACCESS_TOKEN", ) await client.sites.get( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -323,13 +332,13 @@ async def get(self, site_id: str, *, request_options: typing.Optional[RequestOpt if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -339,7 +348,9 @@ async def get_custom_domain( self, site_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> Domains: """ - Get a list of all custom domains related to site.

Required scope | `sites:read` + Get a list of all custom domains related to site. + + Required scope | `sites:read` Parameters ---------- @@ -362,7 +373,7 @@ async def get_custom_domain( access_token="YOUR_ACCESS_TOKEN", ) await client.sites.get_custom_domain( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -372,15 +383,15 @@ async def get_custom_domain( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(Domains, _response.json()) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -393,9 +404,13 @@ async def publish( custom_domains: typing.Optional[typing.Sequence[str]] = OMIT, publish_to_webflow_subdomain: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> None: + ) -> SitesPublishResponse: """ - Publish a site to one more more domains.

Required scope | `sites:write` + Publishes a site to one or more more domains. + + This endpoint has a limit of one successful publish queue per minute. + + Required scope | `sites:write` Parameters ---------- @@ -403,7 +418,7 @@ async def publish( Unique identifier for a Site custom_domains : typing.Optional[typing.Sequence[str]] - Array of Custom Domain ids to publish + Array of Custom Domain IDs to publish publish_to_webflow_subdomain : typing.Optional[bool] Choice of whether to publish to the default Webflow Subdomain @@ -413,7 +428,8 @@ async def publish( Returns ------- - None + SitesPublishResponse + Request accepted Examples -------- @@ -423,7 +439,7 @@ async def publish( access_token="YOUR_ACCESS_TOKEN", ) await client.sites.publish( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -435,17 +451,17 @@ async def publish( ) try: if 200 <= _response.status_code < 300: - return + return pydantic_v1.parse_obj_as(SitesPublishResponse, _response.json()) # type: ignore if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) diff --git a/src/webflow/resources/sites/resources/activity_logs/client.py b/src/webflow/resources/sites/resources/activity_logs/client.py index 63571d4..abcd796 100644 --- a/src/webflow/resources/sites/resources/activity_logs/client.py +++ b/src/webflow/resources/sites/resources/activity_logs/client.py @@ -12,6 +12,7 @@ from .....errors.internal_server_error import InternalServerError from .....errors.not_found_error import NotFoundError from .....errors.too_many_requests_error import TooManyRequestsError +from .....types.error import Error from .....types.site_activity_log_response import SiteActivityLogResponse @@ -57,7 +58,7 @@ def list( access_token="YOUR_ACCESS_TOKEN", ) client.sites.activity_logs.list( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = self._client_wrapper.httpx_client.request( @@ -72,11 +73,11 @@ def list( if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -125,7 +126,7 @@ async def list( access_token="YOUR_ACCESS_TOKEN", ) await client.sites.activity_logs.list( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -140,11 +141,11 @@ async def list( if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) diff --git a/src/webflow/resources/sites/resources/scripts/client.py b/src/webflow/resources/sites/resources/scripts/client.py index 9470804..be8353c 100644 --- a/src/webflow/resources/sites/resources/scripts/client.py +++ b/src/webflow/resources/sites/resources/scripts/client.py @@ -13,6 +13,7 @@ from .....errors.not_found_error import NotFoundError from .....errors.too_many_requests_error import TooManyRequestsError from .....errors.unauthorized_error import UnauthorizedError +from .....types.error import Error from .....types.list_custom_code_blocks import ListCustomCodeBlocks from .....types.script_apply import ScriptApply from .....types.script_apply_list import ScriptApplyList @@ -29,7 +30,11 @@ def get_custom_code( self, site_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> ScriptApplyList: """ - Get all registered scripts that have been applied to a specific Site.
Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:read` + Get all registered scripts that have been applied to a specific Site. + +
Access to this endpoint requires a bearer token from a Data Client App.
+ + Required scope | `custom_code:read` Parameters ---------- @@ -52,7 +57,7 @@ def get_custom_code( access_token="YOUR_ACCESS_TOKEN", ) client.sites.scripts.get_custom_code( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = self._client_wrapper.httpx_client.request( @@ -64,13 +69,13 @@ def get_custom_code( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -86,7 +91,15 @@ def upsert_custom_code( request_options: typing.Optional[RequestOptions] = None, ) -> ScriptApplyList: """ - Add a registered script to a Site.

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints.
Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:write` + Add a registered script to a Site. + + In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered + to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate + `custom_code` endpoints. + +
Access to this endpoint requires a bearer token from a Data Client App.
+ + Required scope | `custom_code:write` Parameters ---------- @@ -119,7 +132,7 @@ def upsert_custom_code( access_token="YOUR_ACCESS_TOKEN", ) client.sites.scripts.upsert_custom_code( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", scripts=[ ScriptApply( id="cms_slider", @@ -148,13 +161,13 @@ def upsert_custom_code( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -162,7 +175,11 @@ def upsert_custom_code( def delete_custom_code(self, site_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: """ - Delete the custom code block that an app created for a Site

Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:write` + Delete the custom code block that an app created for a Site + +
Access to this endpoint requires a bearer token from a Data Client App.
+ + Required scope | `custom_code:write` Parameters ---------- @@ -184,7 +201,7 @@ def delete_custom_code(self, site_id: str, *, request_options: typing.Optional[R access_token="YOUR_ACCESS_TOKEN", ) client.sites.scripts.delete_custom_code( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = self._client_wrapper.httpx_client.request( @@ -196,13 +213,13 @@ def delete_custom_code(self, site_id: str, *, request_options: typing.Optional[R if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -217,7 +234,11 @@ def list_custom_code_blocks( request_options: typing.Optional[RequestOptions] = None, ) -> ListCustomCodeBlocks: """ - Get all instances of Custom Code applied to a Site or Pages.
Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:read` + Get all instances of Custom Code applied to a Site or Pages. + +
Access to this endpoint requires a bearer token from a Data Client App.
+ + Required scope | `custom_code:read` Parameters ---------- @@ -246,7 +267,7 @@ def list_custom_code_blocks( access_token="YOUR_ACCESS_TOKEN", ) client.sites.scripts.list_custom_code_blocks( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = self._client_wrapper.httpx_client.request( @@ -261,13 +282,13 @@ def list_custom_code_blocks( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -282,7 +303,11 @@ async def get_custom_code( self, site_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> ScriptApplyList: """ - Get all registered scripts that have been applied to a specific Site.
Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:read` + Get all registered scripts that have been applied to a specific Site. + +
Access to this endpoint requires a bearer token from a Data Client App.
+ + Required scope | `custom_code:read` Parameters ---------- @@ -305,7 +330,7 @@ async def get_custom_code( access_token="YOUR_ACCESS_TOKEN", ) await client.sites.scripts.get_custom_code( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -317,13 +342,13 @@ async def get_custom_code( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -339,7 +364,15 @@ async def upsert_custom_code( request_options: typing.Optional[RequestOptions] = None, ) -> ScriptApplyList: """ - Add a registered script to a Site.

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints.
Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:write` + Add a registered script to a Site. + + In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered + to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate + `custom_code` endpoints. + +
Access to this endpoint requires a bearer token from a Data Client App.
+ + Required scope | `custom_code:write` Parameters ---------- @@ -372,7 +405,7 @@ async def upsert_custom_code( access_token="YOUR_ACCESS_TOKEN", ) await client.sites.scripts.upsert_custom_code( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", scripts=[ ScriptApply( id="cms_slider", @@ -401,13 +434,13 @@ async def upsert_custom_code( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -417,7 +450,11 @@ async def delete_custom_code( self, site_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> None: """ - Delete the custom code block that an app created for a Site

Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:write` + Delete the custom code block that an app created for a Site + +
Access to this endpoint requires a bearer token from a Data Client App.
+ + Required scope | `custom_code:write` Parameters ---------- @@ -439,7 +476,7 @@ async def delete_custom_code( access_token="YOUR_ACCESS_TOKEN", ) await client.sites.scripts.delete_custom_code( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -451,13 +488,13 @@ async def delete_custom_code( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -472,7 +509,11 @@ async def list_custom_code_blocks( request_options: typing.Optional[RequestOptions] = None, ) -> ListCustomCodeBlocks: """ - Get all instances of Custom Code applied to a Site or Pages.
Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:read` + Get all instances of Custom Code applied to a Site or Pages. + +
Access to this endpoint requires a bearer token from a Data Client App.
+ + Required scope | `custom_code:read` Parameters ---------- @@ -501,7 +542,7 @@ async def list_custom_code_blocks( access_token="YOUR_ACCESS_TOKEN", ) await client.sites.scripts.list_custom_code_blocks( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -516,13 +557,13 @@ async def list_custom_code_blocks( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) diff --git a/src/webflow/resources/sites/types/__init__.py b/src/webflow/resources/sites/types/__init__.py new file mode 100644 index 0000000..c85fd30 --- /dev/null +++ b/src/webflow/resources/sites/types/__init__.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .sites_publish_response import SitesPublishResponse + +__all__ = ["SitesPublishResponse"] diff --git a/src/webflow/resources/sites/types/sites_publish_response.py b/src/webflow/resources/sites/types/sites_publish_response.py new file mode 100644 index 0000000..30b0ea5 --- /dev/null +++ b/src/webflow/resources/sites/types/sites_publish_response.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from ....core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 +from ....types.domain import Domain + + +class SitesPublishResponse(pydantic_v1.BaseModel): + custom_domains: typing.Optional[typing.List[Domain]] = pydantic_v1.Field(alias="customDomains", default=None) + """ + Array of domains objects + """ + + publish_to_webflow_subdomain: typing.Optional[bool] = pydantic_v1.Field( + alias="publishToWebflowSubdomain", default=None + ) + """ + Flag for publishing to webflow.io subdomain + """ + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} + + return deep_union_pydantic_dicts( + super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) + ) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + populate_by_name = True + extra = pydantic_v1.Extra.allow + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/webflow/resources/token/client.py b/src/webflow/resources/token/client.py index 19a9083..d2f37fb 100644 --- a/src/webflow/resources/token/client.py +++ b/src/webflow/resources/token/client.py @@ -11,6 +11,7 @@ from ...errors.unauthorized_error import UnauthorizedError from ...types.authorization import Authorization from ...types.authorized_user import AuthorizedUser +from ...types.error import Error class TokenClient: @@ -19,7 +20,9 @@ def __init__(self, *, client_wrapper: SyncClientWrapper): def authorized_by(self, *, request_options: typing.Optional[RequestOptions] = None) -> AuthorizedUser: """ - Information about the Authorized User

Required Scope | `authorized_user:read` + Information about the Authorized User + + Required Scope | `authorized_user:read` Parameters ---------- @@ -47,7 +50,7 @@ def authorized_by(self, *, request_options: typing.Optional[RequestOptions] = No if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(AuthorizedUser, _response.json()) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore _response_json = _response.json() @@ -57,7 +60,8 @@ def authorized_by(self, *, request_options: typing.Optional[RequestOptions] = No def introspect(self, *, request_options: typing.Optional[RequestOptions] = None) -> Authorization: """ - Information about the authorization token
Access to this endpoint requires a bearer token from a Data Client App.
+ Information about the authorization token + Access to this endpoint requires a bearer token from a []>Data Client App](/data/docs/getting-started-data-clients). Parameters ---------- @@ -85,7 +89,7 @@ def introspect(self, *, request_options: typing.Optional[RequestOptions] = None) if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(Authorization, _response.json()) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -98,7 +102,9 @@ def __init__(self, *, client_wrapper: AsyncClientWrapper): async def authorized_by(self, *, request_options: typing.Optional[RequestOptions] = None) -> AuthorizedUser: """ - Information about the Authorized User

Required Scope | `authorized_user:read` + Information about the Authorized User + + Required Scope | `authorized_user:read` Parameters ---------- @@ -126,7 +132,7 @@ async def authorized_by(self, *, request_options: typing.Optional[RequestOptions if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(AuthorizedUser, _response.json()) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore _response_json = _response.json() @@ -136,7 +142,8 @@ async def authorized_by(self, *, request_options: typing.Optional[RequestOptions async def introspect(self, *, request_options: typing.Optional[RequestOptions] = None) -> Authorization: """ - Information about the authorization token
Access to this endpoint requires a bearer token from a Data Client App.
+ Information about the authorization token + Access to this endpoint requires a bearer token from a []>Data Client App](/data/docs/getting-started-data-clients). Parameters ---------- @@ -164,7 +171,7 @@ async def introspect(self, *, request_options: typing.Optional[RequestOptions] = if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(Authorization, _response.json()) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) diff --git a/src/webflow/resources/users/client.py b/src/webflow/resources/users/client.py index 08e8045..1c0a870 100644 --- a/src/webflow/resources/users/client.py +++ b/src/webflow/resources/users/client.py @@ -15,6 +15,7 @@ from ...errors.not_found_error import NotFoundError from ...errors.too_many_requests_error import TooManyRequestsError from ...errors.unauthorized_error import UnauthorizedError +from ...types.error import Error from ...types.user import User from ...types.user_list import UserList from .types.users_list_request_sort import UsersListRequestSort @@ -38,7 +39,9 @@ def list( request_options: typing.Optional[RequestOptions] = None, ) -> UserList: """ - Get a list of users for a site

Required scope | `users:read` + Get a list of users for a site + + Required scope | `users:read` Parameters ---------- @@ -74,7 +77,7 @@ def list( access_token="YOUR_ACCESS_TOKEN", ) client.users.list( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = self._client_wrapper.httpx_client.request( @@ -89,15 +92,15 @@ def list( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -105,7 +108,9 @@ def list( def get(self, site_id: str, user_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> User: """ - Get a User by ID

Required scope | `users:read` + Get a User by ID + + Required scope | `users:read` Parameters ---------- @@ -131,8 +136,8 @@ def get(self, site_id: str, user_id: str, *, request_options: typing.Optional[Re access_token="YOUR_ACCESS_TOKEN", ) client.users.get( - site_id="site_id", - user_id="user_id", + site_id="580e63e98c9a982ac9b8b741", + user_id="580e63e98c9a982ac9b8b741", ) """ _response = self._client_wrapper.httpx_client.request( @@ -146,15 +151,15 @@ def get(self, site_id: str, user_id: str, *, request_options: typing.Optional[Re if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -162,7 +167,9 @@ def get(self, site_id: str, user_id: str, *, request_options: typing.Optional[Re def delete(self, site_id: str, user_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: """ - Delete a User by ID

Required scope | `users:write` + Delete a User by ID + + Required scope | `users:write` Parameters ---------- @@ -187,8 +194,8 @@ def delete(self, site_id: str, user_id: str, *, request_options: typing.Optional access_token="YOUR_ACCESS_TOKEN", ) client.users.delete( - site_id="site_id", - user_id="user_id", + site_id="580e63e98c9a982ac9b8b741", + user_id="580e63e98c9a982ac9b8b741", ) """ _response = self._client_wrapper.httpx_client.request( @@ -202,15 +209,15 @@ def delete(self, site_id: str, user_id: str, *, request_options: typing.Optional if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -226,9 +233,12 @@ def update( request_options: typing.Optional[RequestOptions] = None, ) -> User: """ - Update a User by ID

Required scope | `users:write` + Update a User by ID - + Required scope | `users:write` + + The email and password + fields cannot be updated using this endpoint Parameters ---------- @@ -261,8 +271,8 @@ def update( access_token="YOUR_ACCESS_TOKEN", ) client.users.update( - site_id="site_id", - user_id="user_id", + site_id="580e63e98c9a982ac9b8b741", + user_id="580e63e98c9a982ac9b8b741", data=UsersUpdateRequestData( name="Some One", accept_privacy=False, @@ -284,15 +294,15 @@ def update( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -307,7 +317,11 @@ def invite( request_options: typing.Optional[RequestOptions] = None, ) -> User: """ - Create and invite a user with an email address. The user will be sent and invite via email, which they will need to accept in order to join paid Access Groups.

Required scope | `users:write` + Create and invite a user with an email address. + + The user will be sent and invite via email, which they will need to accept in order to join paid any paid access group. + + Required scope | `users:write` Parameters ---------- @@ -337,7 +351,7 @@ def invite( access_token="YOUR_ACCESS_TOKEN", ) client.users.invite( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", email="some.one@home.com", access_groups=["webflowers"], ) @@ -355,17 +369,17 @@ def invite( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -386,7 +400,9 @@ async def list( request_options: typing.Optional[RequestOptions] = None, ) -> UserList: """ - Get a list of users for a site

Required scope | `users:read` + Get a list of users for a site + + Required scope | `users:read` Parameters ---------- @@ -422,7 +438,7 @@ async def list( access_token="YOUR_ACCESS_TOKEN", ) await client.users.list( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -437,15 +453,15 @@ async def list( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -453,7 +469,9 @@ async def list( async def get(self, site_id: str, user_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> User: """ - Get a User by ID

Required scope | `users:read` + Get a User by ID + + Required scope | `users:read` Parameters ---------- @@ -479,8 +497,8 @@ async def get(self, site_id: str, user_id: str, *, request_options: typing.Optio access_token="YOUR_ACCESS_TOKEN", ) await client.users.get( - site_id="site_id", - user_id="user_id", + site_id="580e63e98c9a982ac9b8b741", + user_id="580e63e98c9a982ac9b8b741", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -494,15 +512,15 @@ async def get(self, site_id: str, user_id: str, *, request_options: typing.Optio if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -512,7 +530,9 @@ async def delete( self, site_id: str, user_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> None: """ - Delete a User by ID

Required scope | `users:write` + Delete a User by ID + + Required scope | `users:write` Parameters ---------- @@ -537,8 +557,8 @@ async def delete( access_token="YOUR_ACCESS_TOKEN", ) await client.users.delete( - site_id="site_id", - user_id="user_id", + site_id="580e63e98c9a982ac9b8b741", + user_id="580e63e98c9a982ac9b8b741", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -552,15 +572,15 @@ async def delete( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -576,9 +596,12 @@ async def update( request_options: typing.Optional[RequestOptions] = None, ) -> User: """ - Update a User by ID

Required scope | `users:write` + Update a User by ID - + Required scope | `users:write` + + The email and password + fields cannot be updated using this endpoint Parameters ---------- @@ -611,8 +634,8 @@ async def update( access_token="YOUR_ACCESS_TOKEN", ) await client.users.update( - site_id="site_id", - user_id="user_id", + site_id="580e63e98c9a982ac9b8b741", + user_id="580e63e98c9a982ac9b8b741", data=UsersUpdateRequestData( name="Some One", accept_privacy=False, @@ -634,15 +657,15 @@ async def update( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -657,7 +680,11 @@ async def invite( request_options: typing.Optional[RequestOptions] = None, ) -> User: """ - Create and invite a user with an email address. The user will be sent and invite via email, which they will need to accept in order to join paid Access Groups.

Required scope | `users:write` + Create and invite a user with an email address. + + The user will be sent and invite via email, which they will need to accept in order to join paid any paid access group. + + Required scope | `users:write` Parameters ---------- @@ -687,7 +714,7 @@ async def invite( access_token="YOUR_ACCESS_TOKEN", ) await client.users.invite( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", email="some.one@home.com", access_groups=["webflowers"], ) @@ -705,17 +732,17 @@ async def invite( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 403: raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 409: raise ConflictError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) diff --git a/src/webflow/resources/webhooks/client.py b/src/webflow/resources/webhooks/client.py index 9225c18..055d25a 100644 --- a/src/webflow/resources/webhooks/client.py +++ b/src/webflow/resources/webhooks/client.py @@ -1,5 +1,6 @@ # This file was auto-generated by Fern from our API Definition. +import datetime as dt import typing from json.decoder import JSONDecodeError @@ -13,8 +14,10 @@ from ...errors.not_found_error import NotFoundError from ...errors.too_many_requests_error import TooManyRequestsError from ...errors.unauthorized_error import UnauthorizedError +from ...types.error import Error from ...types.trigger_type import TriggerType from ...types.webhook import Webhook +from ...types.webhook_filter import WebhookFilter from ...types.webhook_list import WebhookList # this is used as the default value for optional parameters @@ -27,7 +30,9 @@ def __init__(self, *, client_wrapper: SyncClientWrapper): def list(self, site_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> WebhookList: """ - List all App-created Webhooks registered for a given site

Required scope | `sites:read` + List all App-created Webhooks registered for a given site + + Required scope | `sites:read` Parameters ---------- @@ -50,7 +55,7 @@ def list(self, site_id: str, *, request_options: typing.Optional[RequestOptions] access_token="YOUR_ACCESS_TOKEN", ) client.webhooks.list( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = self._client_wrapper.httpx_client.request( @@ -62,13 +67,13 @@ def list(self, site_id: str, *, request_options: typing.Optional[RequestOptions] if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -76,31 +81,53 @@ def list(self, site_id: str, *, request_options: typing.Optional[RequestOptions] def create( self, - site_id: str, + site_id_: str, *, - trigger_type: TriggerType, - url: str, - filter: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, + id: typing.Optional[str] = OMIT, + trigger_type: typing.Optional[TriggerType] = OMIT, + url: typing.Optional[str] = OMIT, + workspace_id: typing.Optional[str] = OMIT, + site_id: typing.Optional[str] = OMIT, + filter: typing.Optional[WebhookFilter] = OMIT, + last_triggered: typing.Optional[dt.datetime] = OMIT, + created_on: typing.Optional[dt.datetime] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> Webhook: """ - Create a new Webhook, to be notified when Webflow resources change. Limit of 75 registrations per `triggerType`, per site.
Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `sites:write` + Create a new Webhook. + + Limit of 75 registrations per `triggerType`, per site. + +
Access to this endpoint requires a bearer token from a Data Client App.
+ Required scope | `sites:write` Parameters ---------- - site_id : str + site_id_ : str Unique identifier for a Site - trigger_type : TriggerType + id : typing.Optional[str] + Unique identifier for the Webhook registration + + trigger_type : typing.Optional[TriggerType] - url : str - The server URI that Webflow will call when your Webhook is triggered + url : typing.Optional[str] + URL to send the Webhook payload to + workspace_id : typing.Optional[str] + Unique identifier for the Workspace the Webhook is registered in - filter : typing.Optional[typing.Dict[str, typing.Any]] - Filter for selecting which events you want Webhooks to be triggered for. - ** Only available for `form_submission` trigger types. ** + site_id : typing.Optional[str] + Unique identifier for the Site the Webhook is registered in + filter : typing.Optional[WebhookFilter] + Only supported for the `form_submission` trigger type. Filter for the form you want Webhooks to be sent for. + + last_triggered : typing.Optional[dt.datetime] + Date the Webhook instance was last triggered + + created_on : typing.Optional[dt.datetime] + Date the Webhook registration was created request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -112,6 +139,8 @@ def create( Examples -------- + import datetime + from webflow import TriggerType from webflow.client import Webflow @@ -119,15 +148,33 @@ def create( access_token="YOUR_ACCESS_TOKEN", ) client.webhooks.create( - site_id="site_id", + site_id_="580e63e98c9a982ac9b8b741", + id="582266e0cd48de0f0e3c6d8b", trigger_type=TriggerType.FORM_SUBMISSION, - url="https://api.mydomain.com/webhook", + url="https://webhook.site/7f7f7f7f-7f7f-7f7f-7f7f-7f7f7f7f7f7f", + workspace_id="4f4e46fd476ea8c507000001", + site_id="562ac0395358780a1f5e6fbd", + last_triggered=datetime.datetime.fromisoformat( + "2023-02-08 23:59:28+00:00", + ), + created_on=datetime.datetime.fromisoformat( + "2022-11-08 23:59:28+00:00", + ), ) """ _response = self._client_wrapper.httpx_client.request( - f"sites/{jsonable_encoder(site_id)}/webhooks", + f"sites/{jsonable_encoder(site_id_)}/webhooks", method="POST", - json={"triggerType": trigger_type, "url": url, "filter": filter}, + json={ + "id": id, + "triggerType": trigger_type, + "url": url, + "workspaceId": workspace_id, + "siteId": site_id, + "filter": filter, + "lastTriggered": last_triggered, + "createdOn": created_on, + }, request_options=request_options, omit=OMIT, ) @@ -137,13 +184,13 @@ def create( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -153,6 +200,8 @@ def get(self, webhook_id: str, *, request_options: typing.Optional[RequestOption """ Get a specific Webhook instance + Required scope: `sites:read` + Parameters ---------- webhook_id : str @@ -174,7 +223,7 @@ def get(self, webhook_id: str, *, request_options: typing.Optional[RequestOption access_token="YOUR_ACCESS_TOKEN", ) client.webhooks.get( - webhook_id="webhook_id", + webhook_id="580e64008c9a982ac9b8b754", ) """ _response = self._client_wrapper.httpx_client.request( @@ -186,13 +235,13 @@ def get(self, webhook_id: str, *, request_options: typing.Optional[RequestOption if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -202,6 +251,8 @@ def delete(self, webhook_id: str, *, request_options: typing.Optional[RequestOpt """ Remove a Webhook + Required scope: `sites:read` + Parameters ---------- webhook_id : str @@ -222,7 +273,7 @@ def delete(self, webhook_id: str, *, request_options: typing.Optional[RequestOpt access_token="YOUR_ACCESS_TOKEN", ) client.webhooks.delete( - webhook_id="webhook_id", + webhook_id="580e64008c9a982ac9b8b754", ) """ _response = self._client_wrapper.httpx_client.request( @@ -234,13 +285,13 @@ def delete(self, webhook_id: str, *, request_options: typing.Optional[RequestOpt if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -253,7 +304,9 @@ def __init__(self, *, client_wrapper: AsyncClientWrapper): async def list(self, site_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> WebhookList: """ - List all App-created Webhooks registered for a given site

Required scope | `sites:read` + List all App-created Webhooks registered for a given site + + Required scope | `sites:read` Parameters ---------- @@ -276,7 +329,7 @@ async def list(self, site_id: str, *, request_options: typing.Optional[RequestOp access_token="YOUR_ACCESS_TOKEN", ) await client.webhooks.list( - site_id="site_id", + site_id="580e63e98c9a982ac9b8b741", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -288,13 +341,13 @@ async def list(self, site_id: str, *, request_options: typing.Optional[RequestOp if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -302,31 +355,53 @@ async def list(self, site_id: str, *, request_options: typing.Optional[RequestOp async def create( self, - site_id: str, + site_id_: str, *, - trigger_type: TriggerType, - url: str, - filter: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, + id: typing.Optional[str] = OMIT, + trigger_type: typing.Optional[TriggerType] = OMIT, + url: typing.Optional[str] = OMIT, + workspace_id: typing.Optional[str] = OMIT, + site_id: typing.Optional[str] = OMIT, + filter: typing.Optional[WebhookFilter] = OMIT, + last_triggered: typing.Optional[dt.datetime] = OMIT, + created_on: typing.Optional[dt.datetime] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> Webhook: """ - Create a new Webhook, to be notified when Webflow resources change. Limit of 75 registrations per `triggerType`, per site.
Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `sites:write` + Create a new Webhook. + + Limit of 75 registrations per `triggerType`, per site. + +
Access to this endpoint requires a bearer token from a Data Client App.
+ Required scope | `sites:write` Parameters ---------- - site_id : str + site_id_ : str Unique identifier for a Site - trigger_type : TriggerType + id : typing.Optional[str] + Unique identifier for the Webhook registration + + trigger_type : typing.Optional[TriggerType] - url : str - The server URI that Webflow will call when your Webhook is triggered + url : typing.Optional[str] + URL to send the Webhook payload to + workspace_id : typing.Optional[str] + Unique identifier for the Workspace the Webhook is registered in - filter : typing.Optional[typing.Dict[str, typing.Any]] - Filter for selecting which events you want Webhooks to be triggered for. - ** Only available for `form_submission` trigger types. ** + site_id : typing.Optional[str] + Unique identifier for the Site the Webhook is registered in + filter : typing.Optional[WebhookFilter] + Only supported for the `form_submission` trigger type. Filter for the form you want Webhooks to be sent for. + + last_triggered : typing.Optional[dt.datetime] + Date the Webhook instance was last triggered + + created_on : typing.Optional[dt.datetime] + Date the Webhook registration was created request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -338,6 +413,8 @@ async def create( Examples -------- + import datetime + from webflow import TriggerType from webflow.client import AsyncWebflow @@ -345,15 +422,33 @@ async def create( access_token="YOUR_ACCESS_TOKEN", ) await client.webhooks.create( - site_id="site_id", + site_id_="580e63e98c9a982ac9b8b741", + id="582266e0cd48de0f0e3c6d8b", trigger_type=TriggerType.FORM_SUBMISSION, - url="https://api.mydomain.com/webhook", + url="https://webhook.site/7f7f7f7f-7f7f-7f7f-7f7f-7f7f7f7f7f7f", + workspace_id="4f4e46fd476ea8c507000001", + site_id="562ac0395358780a1f5e6fbd", + last_triggered=datetime.datetime.fromisoformat( + "2023-02-08 23:59:28+00:00", + ), + created_on=datetime.datetime.fromisoformat( + "2022-11-08 23:59:28+00:00", + ), ) """ _response = await self._client_wrapper.httpx_client.request( - f"sites/{jsonable_encoder(site_id)}/webhooks", + f"sites/{jsonable_encoder(site_id_)}/webhooks", method="POST", - json={"triggerType": trigger_type, "url": url, "filter": filter}, + json={ + "id": id, + "triggerType": trigger_type, + "url": url, + "workspaceId": workspace_id, + "siteId": site_id, + "filter": filter, + "lastTriggered": last_triggered, + "createdOn": created_on, + }, request_options=request_options, omit=OMIT, ) @@ -363,13 +458,13 @@ async def create( if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -379,6 +474,8 @@ async def get(self, webhook_id: str, *, request_options: typing.Optional[Request """ Get a specific Webhook instance + Required scope: `sites:read` + Parameters ---------- webhook_id : str @@ -400,7 +497,7 @@ async def get(self, webhook_id: str, *, request_options: typing.Optional[Request access_token="YOUR_ACCESS_TOKEN", ) await client.webhooks.get( - webhook_id="webhook_id", + webhook_id="580e64008c9a982ac9b8b754", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -412,13 +509,13 @@ async def get(self, webhook_id: str, *, request_options: typing.Optional[Request if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) @@ -428,6 +525,8 @@ async def delete(self, webhook_id: str, *, request_options: typing.Optional[Requ """ Remove a Webhook + Required scope: `sites:read` + Parameters ---------- webhook_id : str @@ -448,7 +547,7 @@ async def delete(self, webhook_id: str, *, request_options: typing.Optional[Requ access_token="YOUR_ACCESS_TOKEN", ) await client.webhooks.delete( - webhook_id="webhook_id", + webhook_id="580e64008c9a982ac9b8b754", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -460,13 +559,13 @@ async def delete(self, webhook_id: str, *, request_options: typing.Optional[Requ if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise UnauthorizedError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise NotFoundError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 429: - raise TooManyRequestsError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise TooManyRequestsError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore + raise InternalServerError(pydantic_v1.parse_obj_as(Error, _response.json())) # type: ignore _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) diff --git a/src/webflow/types/__init__.py b/src/webflow/types/__init__.py index 16b5e7c..f863258 100644 --- a/src/webflow/types/__init__.py +++ b/src/webflow/types/__init__.py @@ -15,11 +15,20 @@ from .authorization_authorization_authorized_to import AuthorizationAuthorizationAuthorizedTo from .authorized_user import AuthorizedUser from .bad_request_error_body import BadRequestErrorBody +from .bulk_collection_item import BulkCollectionItem +from .bulk_collection_item_field_data import BulkCollectionItemFieldData from .collection import Collection from .collection_item import CollectionItem from .collection_item_field_data import CollectionItemFieldData from .collection_item_list import CollectionItemList +from .collection_item_list_no_pagination import CollectionItemListNoPagination from .collection_item_list_pagination import CollectionItemListPagination +from .collection_item_patch_single import CollectionItemPatchSingle +from .collection_item_patch_single_field_data import CollectionItemPatchSingleFieldData +from .collection_item_post_single import CollectionItemPostSingle +from .collection_item_post_single_field_data import CollectionItemPostSingleFieldData +from .collection_item_with_id_input import CollectionItemWithIdInput +from .collection_item_with_id_input_field_data import CollectionItemWithIdInputFieldData from .collection_list import CollectionList from .collection_list_array_item import CollectionListArrayItem from .conflict_error_body import ConflictErrorBody @@ -33,6 +42,7 @@ from .duplicate_user_email import DuplicateUserEmail from .ecommerce_settings import EcommerceSettings from .error import Error +from .error_code import ErrorCode from .error_details_item import ErrorDetailsItem from .field import Field from .field_type import FieldType @@ -47,17 +57,16 @@ from .form_submission_list import FormSubmissionList from .image_node import ImageNode from .invalid_domain import InvalidDomain +from .invalid_scopes import InvalidScopes from .inventory_item import InventoryItem from .inventory_item_inventory_type import InventoryItemInventoryType from .list_custom_code_blocks import ListCustomCodeBlocks from .locale import Locale from .locales import Locales -from .missing_scopes import MissingScopes from .no_domains import NoDomains from .node import Node from .node_type import NodeType from .not_enterprise_plan_site import NotEnterprisePlanSite -from .oauth_scope import OauthScope from .order import Order from .order_address import OrderAddress from .order_address_japan_type import OrderAddressJapanType @@ -77,9 +86,6 @@ from .order_totals_extras_item import OrderTotalsExtrasItem from .order_totals_extras_item_type import OrderTotalsExtrasItemType from .page import Page -from .page_details import PageDetails -from .page_details_open_graph import PageDetailsOpenGraph -from .page_details_seo import PageDetailsSeo from .page_list import PageList from .page_open_graph import PageOpenGraph from .page_seo import PageSeo @@ -99,9 +105,11 @@ from .scripts import Scripts from .site import Site from .site_activity_log_item import SiteActivityLogItem +from .site_activity_log_item_event import SiteActivityLogItemEvent from .site_activity_log_item_resource_operation import SiteActivityLogItemResourceOperation from .site_activity_log_item_user import SiteActivityLogItemUser from .site_activity_log_response import SiteActivityLogResponse +from .site_data_collection_type import SiteDataCollectionType from .sites import Sites from .sku import Sku from .sku_field_data import SkuFieldData @@ -131,6 +139,7 @@ from .user_status import UserStatus from .users_not_enabled import UsersNotEnabled from .webhook import Webhook +from .webhook_filter import WebhookFilter from .webhook_list import WebhookList __all__ = [ @@ -149,11 +158,20 @@ "AuthorizationAuthorizationAuthorizedTo", "AuthorizedUser", "BadRequestErrorBody", + "BulkCollectionItem", + "BulkCollectionItemFieldData", "Collection", "CollectionItem", "CollectionItemFieldData", "CollectionItemList", + "CollectionItemListNoPagination", "CollectionItemListPagination", + "CollectionItemPatchSingle", + "CollectionItemPatchSingleFieldData", + "CollectionItemPostSingle", + "CollectionItemPostSingleFieldData", + "CollectionItemWithIdInput", + "CollectionItemWithIdInputFieldData", "CollectionList", "CollectionListArrayItem", "ConflictErrorBody", @@ -167,6 +185,7 @@ "DuplicateUserEmail", "EcommerceSettings", "Error", + "ErrorCode", "ErrorDetailsItem", "Field", "FieldType", @@ -181,17 +200,16 @@ "FormSubmissionList", "ImageNode", "InvalidDomain", + "InvalidScopes", "InventoryItem", "InventoryItemInventoryType", "ListCustomCodeBlocks", "Locale", "Locales", - "MissingScopes", "NoDomains", "Node", "NodeType", "NotEnterprisePlanSite", - "OauthScope", "Order", "OrderAddress", "OrderAddressJapanType", @@ -211,9 +229,6 @@ "OrderTotalsExtrasItem", "OrderTotalsExtrasItemType", "Page", - "PageDetails", - "PageDetailsOpenGraph", - "PageDetailsSeo", "PageList", "PageOpenGraph", "PageSeo", @@ -233,9 +248,11 @@ "Scripts", "Site", "SiteActivityLogItem", + "SiteActivityLogItemEvent", "SiteActivityLogItemResourceOperation", "SiteActivityLogItemUser", "SiteActivityLogResponse", + "SiteDataCollectionType", "Sites", "Sku", "SkuFieldData", @@ -265,5 +282,6 @@ "UserStatus", "UsersNotEnabled", "Webhook", + "WebhookFilter", "WebhookList", ] diff --git a/src/webflow/types/asset.py b/src/webflow/types/asset.py index d76f5ed..2a60db5 100644 --- a/src/webflow/types/asset.py +++ b/src/webflow/types/asset.py @@ -14,16 +14,6 @@ class Asset(pydantic_v1.BaseModel): Unique identifier for this asset """ - original_file_name: typing.Optional[str] = pydantic_v1.Field(alias="originalFileName", default=None) - """ - Original file name at the time of upload - """ - - display_name: typing.Optional[str] = pydantic_v1.Field(alias="displayName", default=None) - """ - Display name of the asset - """ - content_type: typing.Optional[str] = pydantic_v1.Field(alias="contentType", default=None) """ File format type @@ -39,9 +29,19 @@ class Asset(pydantic_v1.BaseModel): Unique identifier for the site that hosts this asset """ - created_on: typing.Optional[dt.datetime] = pydantic_v1.Field(alias="createdOn", default=None) + hosted_url: typing.Optional[str] = pydantic_v1.Field(alias="hostedUrl", default=None) """ - Date the asset metadata was created + Link to the asset + """ + + original_file_name: typing.Optional[str] = pydantic_v1.Field(alias="originalFileName", default=None) + """ + Original file name at the time of upload + """ + + display_name: typing.Optional[str] = pydantic_v1.Field(alias="displayName", default=None) + """ + Display name of the asset """ last_updated: typing.Optional[dt.datetime] = pydantic_v1.Field(alias="lastUpdated", default=None) @@ -49,12 +49,16 @@ class Asset(pydantic_v1.BaseModel): Date the asset metadata was last updated """ - hosted_url: typing.Optional[str] = pydantic_v1.Field(alias="hostedUrl", default=None) + created_on: typing.Optional[dt.datetime] = pydantic_v1.Field(alias="createdOn", default=None) """ - Link to the asset + Date the asset metadata was created """ variants: typing.Optional[typing.List[AssetVariant]] = None + alt_text: typing.Optional[str] = pydantic_v1.Field(alias="altText", default=None) + """ + The visual description of the asset + """ def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/src/webflow/types/asset_folder.py b/src/webflow/types/asset_folder.py index 2406d37..4366ca4 100644 --- a/src/webflow/types/asset_folder.py +++ b/src/webflow/types/asset_folder.py @@ -34,7 +34,7 @@ class AssetFolder(pydantic_v1.BaseModel): site_id: typing.Optional[str] = pydantic_v1.Field(alias="siteId", default=None) """ - The unique id of the site the Asset Folder belongs to + The unique ID of the site the Asset Folder belongs to """ created_on: typing.Optional[dt.datetime] = pydantic_v1.Field(alias="createdOn", default=None) diff --git a/src/webflow/types/authorization_authorization.py b/src/webflow/types/authorization_authorization.py index 9410526..2b97906 100644 --- a/src/webflow/types/authorization_authorization.py +++ b/src/webflow/types/authorization_authorization.py @@ -15,7 +15,7 @@ class AuthorizationAuthorization(pydantic_v1.BaseModel): id: typing.Optional[str] = pydantic_v1.Field(default=None) """ - The unique id of the Authorization instance + The unique ID of the Authorization instance """ created_on: typing.Optional[dt.datetime] = pydantic_v1.Field(alias="createdOn", default=None) diff --git a/src/webflow/types/authorized_user.py b/src/webflow/types/authorized_user.py index 80c4931..ff63d47 100644 --- a/src/webflow/types/authorized_user.py +++ b/src/webflow/types/authorized_user.py @@ -10,7 +10,7 @@ class AuthorizedUser(pydantic_v1.BaseModel): id: typing.Optional[str] = pydantic_v1.Field(default=None) """ - The unique id of the user + The unique ID of the user """ email: typing.Optional[str] = pydantic_v1.Field(default=None) diff --git a/src/webflow/types/bulk_collection_item.py b/src/webflow/types/bulk_collection_item.py new file mode 100644 index 0000000..2dac295 --- /dev/null +++ b/src/webflow/types/bulk_collection_item.py @@ -0,0 +1,71 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ..core.datetime_utils import serialize_datetime +from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 +from .bulk_collection_item_field_data import BulkCollectionItemFieldData + + +class BulkCollectionItem(pydantic_v1.BaseModel): + """ + The fields that define the schema for a given Item are based on the Collection that Item belongs to. Beyond the user defined fields, there are a handful of additional fields that are automatically created for all items + """ + + id: str = pydantic_v1.Field() + """ + Unique identifier for the Item + """ + + cms_locale_ids: typing.Optional[typing.List[str]] = pydantic_v1.Field(alias="cmsLocaleIds", default=None) + """ + Array of identifiers for the locales where the item will be created + """ + + last_published: typing.Optional[str] = pydantic_v1.Field(alias="lastPublished", default=None) + """ + The date the item was last published + """ + + last_updated: typing.Optional[str] = pydantic_v1.Field(alias="lastUpdated", default=None) + """ + The date the item was last updated + """ + + created_on: typing.Optional[str] = pydantic_v1.Field(alias="createdOn", default=None) + """ + The date the item was created + """ + + is_archived: typing.Optional[bool] = pydantic_v1.Field(alias="isArchived", default=None) + """ + Boolean determining if the Item is set to archived + """ + + is_draft: typing.Optional[bool] = pydantic_v1.Field(alias="isDraft", default=None) + """ + Boolean determining if the Item is set to draft + """ + + field_data: typing.Optional[BulkCollectionItemFieldData] = pydantic_v1.Field(alias="fieldData", default=None) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} + + return deep_union_pydantic_dicts( + super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) + ) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + populate_by_name = True + extra = pydantic_v1.Extra.allow + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/webflow/resources/collections/resources/items/types/bulk_collection_item_field_data.py b/src/webflow/types/bulk_collection_item_field_data.py similarity index 90% rename from src/webflow/resources/collections/resources/items/types/bulk_collection_item_field_data.py rename to src/webflow/types/bulk_collection_item_field_data.py index dadc943..b2bc161 100644 --- a/src/webflow/resources/collections/resources/items/types/bulk_collection_item_field_data.py +++ b/src/webflow/types/bulk_collection_item_field_data.py @@ -3,8 +3,8 @@ import datetime as dt import typing -from ......core.datetime_utils import serialize_datetime -from ......core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 +from ..core.datetime_utils import serialize_datetime +from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 class BulkCollectionItemFieldData(pydantic_v1.BaseModel): diff --git a/src/webflow/types/collection_item.py b/src/webflow/types/collection_item.py index d7e2e1d..8f649a4 100644 --- a/src/webflow/types/collection_item.py +++ b/src/webflow/types/collection_item.py @@ -10,10 +10,14 @@ class CollectionItem(pydantic_v1.BaseModel): """ - The fields that define the schema for a given Item are based on the Collection that Item belongs to. Beyond the user defined fields, there are a handful of additional fields that are automatically created for all items + A Collection Item represents a single entry in your collection. Each item includes: + + - **System metadata** - Automatically managed fields like IDs and timestamp
+ - **Status flags** - Controls for managing content state: `isDraft`, `isArchived `
+ - **Content fields** - Stored in `fieldData`. Each item needs a `name` and `slug`, and may include additional fields matching your collection's schema definition. """ - id: str = pydantic_v1.Field() + id: typing.Optional[str] = pydantic_v1.Field(default=None) """ Unique identifier for the Item """ @@ -48,7 +52,7 @@ class CollectionItem(pydantic_v1.BaseModel): Boolean determining if the Item is set to draft """ - field_data: typing.Optional[CollectionItemFieldData] = pydantic_v1.Field(alias="fieldData", default=None) + field_data: CollectionItemFieldData = pydantic_v1.Field(alias="fieldData") def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/src/webflow/types/collection_item_field_data.py b/src/webflow/types/collection_item_field_data.py index 19b8588..9782b6b 100644 --- a/src/webflow/types/collection_item_field_data.py +++ b/src/webflow/types/collection_item_field_data.py @@ -8,12 +8,12 @@ class CollectionItemFieldData(pydantic_v1.BaseModel): - name: typing.Optional[str] = pydantic_v1.Field(default=None) + name: str = pydantic_v1.Field() """ Name of the Item """ - slug: typing.Optional[str] = pydantic_v1.Field(default=None) + slug: str = pydantic_v1.Field() """ URL structure of the Item in your site. Note: Updates to an item slug will break all links referencing the old slug. """ diff --git a/src/webflow/types/collection_item_list_no_pagination.py b/src/webflow/types/collection_item_list_no_pagination.py new file mode 100644 index 0000000..f17de8d --- /dev/null +++ b/src/webflow/types/collection_item_list_no_pagination.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ..core.datetime_utils import serialize_datetime +from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 +from .collection_item import CollectionItem + + +class CollectionItemListNoPagination(pydantic_v1.BaseModel): + """ + Results from collection items list + """ + + items: typing.Optional[typing.List[CollectionItem]] = pydantic_v1.Field(default=None) + """ + List of Items within the collection + """ + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} + + return deep_union_pydantic_dicts( + super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) + ) + + class Config: + frozen = True + smart_union = True + extra = pydantic_v1.Extra.allow + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/webflow/types/collection_item_patch_single.py b/src/webflow/types/collection_item_patch_single.py new file mode 100644 index 0000000..4e24028 --- /dev/null +++ b/src/webflow/types/collection_item_patch_single.py @@ -0,0 +1,71 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ..core.datetime_utils import serialize_datetime +from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 +from .collection_item_patch_single_field_data import CollectionItemPatchSingleFieldData + + +class CollectionItemPatchSingle(pydantic_v1.BaseModel): + """ + The fields that define the schema for a given Item are based on the Collection that Item belongs to. Beyond the user defined fields, there are a handful of additional fields that are automatically created for all items + """ + + id: typing.Optional[str] = pydantic_v1.Field(default=None) + """ + Unique identifier for the Item + """ + + cms_locale_id: typing.Optional[str] = pydantic_v1.Field(alias="cmsLocaleId", default=None) + """ + Identifier for the locale of the CMS item + """ + + last_published: typing.Optional[str] = pydantic_v1.Field(alias="lastPublished", default=None) + """ + The date the item was last published + """ + + last_updated: typing.Optional[str] = pydantic_v1.Field(alias="lastUpdated", default=None) + """ + The date the item was last updated + """ + + created_on: typing.Optional[str] = pydantic_v1.Field(alias="createdOn", default=None) + """ + The date the item was created + """ + + is_archived: typing.Optional[bool] = pydantic_v1.Field(alias="isArchived", default=None) + """ + Boolean determining if the Item is set to archived + """ + + is_draft: typing.Optional[bool] = pydantic_v1.Field(alias="isDraft", default=None) + """ + Boolean determining if the Item is set to draft + """ + + field_data: typing.Optional[CollectionItemPatchSingleFieldData] = pydantic_v1.Field(alias="fieldData", default=None) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} + + return deep_union_pydantic_dicts( + super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) + ) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + populate_by_name = True + extra = pydantic_v1.Extra.allow + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/webflow/types/page_details_seo.py b/src/webflow/types/collection_item_patch_single_field_data.py similarity index 76% rename from src/webflow/types/page_details_seo.py rename to src/webflow/types/collection_item_patch_single_field_data.py index 7038e39..81097ab 100644 --- a/src/webflow/types/page_details_seo.py +++ b/src/webflow/types/collection_item_patch_single_field_data.py @@ -7,19 +7,15 @@ from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 -class PageDetailsSeo(pydantic_v1.BaseModel): +class CollectionItemPatchSingleFieldData(pydantic_v1.BaseModel): + name: typing.Optional[str] = pydantic_v1.Field(default=None) """ - SEO-related fields for the Page + Name of the Item """ - title: typing.Optional[str] = pydantic_v1.Field(default=None) + slug: typing.Optional[str] = pydantic_v1.Field(default=None) """ - The Page title shown in search engine results - """ - - description: typing.Optional[str] = pydantic_v1.Field(default=None) - """ - The Page description shown in search engine results + URL structure of the Item in your site. Note: Updates to an item slug will break all links referencing the old slug. """ def json(self, **kwargs: typing.Any) -> str: diff --git a/src/webflow/types/collection_item_post_single.py b/src/webflow/types/collection_item_post_single.py new file mode 100644 index 0000000..ba564e0 --- /dev/null +++ b/src/webflow/types/collection_item_post_single.py @@ -0,0 +1,75 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ..core.datetime_utils import serialize_datetime +from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 +from .collection_item_post_single_field_data import CollectionItemPostSingleFieldData + + +class CollectionItemPostSingle(pydantic_v1.BaseModel): + """ + A Collection Item represents a single entry in your collection. Each item includes: + + - **System metadata** - Automatically managed fields like IDs and timestamp
+ - **Status flags** - Controls for managing content state: `isDraft`, `isArchived `
+ - **Content fields** - Stored in `fieldData`. Each item needs a `name` and `slug`, and may include additional fields matching your collection's schema definition. + """ + + id: typing.Optional[str] = pydantic_v1.Field(default=None) + """ + Unique identifier for the Item + """ + + cms_locale_id: typing.Optional[str] = pydantic_v1.Field(alias="cmsLocaleId", default=None) + """ + Identifier for the locale of the CMS item + """ + + last_published: typing.Optional[str] = pydantic_v1.Field(alias="lastPublished", default=None) + """ + The date the item was last published + """ + + last_updated: typing.Optional[str] = pydantic_v1.Field(alias="lastUpdated", default=None) + """ + The date the item was last updated + """ + + created_on: typing.Optional[str] = pydantic_v1.Field(alias="createdOn", default=None) + """ + The date the item was created + """ + + is_archived: typing.Optional[bool] = pydantic_v1.Field(alias="isArchived", default=None) + """ + Boolean determining if the Item is in an archived state. + """ + + is_draft: typing.Optional[bool] = pydantic_v1.Field(alias="isDraft", default=None) + """ + Boolean determining if the Item is in a draft state. + """ + + field_data: CollectionItemPostSingleFieldData = pydantic_v1.Field(alias="fieldData") + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} + + return deep_union_pydantic_dicts( + super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) + ) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + populate_by_name = True + extra = pydantic_v1.Extra.allow + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/webflow/types/collection_item_post_single_field_data.py b/src/webflow/types/collection_item_post_single_field_data.py new file mode 100644 index 0000000..e22e4e9 --- /dev/null +++ b/src/webflow/types/collection_item_post_single_field_data.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ..core.datetime_utils import serialize_datetime +from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 + + +class CollectionItemPostSingleFieldData(pydantic_v1.BaseModel): + name: str = pydantic_v1.Field() + """ + Name of the Item + """ + + slug: str = pydantic_v1.Field() + """ + URL structure of the Item in your site. Note: Updates to an item slug will break all links referencing the old slug. + """ + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} + + return deep_union_pydantic_dicts( + super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) + ) + + class Config: + frozen = True + smart_union = True + extra = pydantic_v1.Extra.allow + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/webflow/types/collection_item_with_id_input.py b/src/webflow/types/collection_item_with_id_input.py new file mode 100644 index 0000000..9e55a5c --- /dev/null +++ b/src/webflow/types/collection_item_with_id_input.py @@ -0,0 +1,71 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ..core.datetime_utils import serialize_datetime +from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 +from .collection_item_with_id_input_field_data import CollectionItemWithIdInputFieldData + + +class CollectionItemWithIdInput(pydantic_v1.BaseModel): + """ + The fields that define the schema for a given Item are based on the Collection that Item belongs to. Beyond the user defined fields, there are a handful of additional fields that are automatically created for all items + """ + + id: str = pydantic_v1.Field() + """ + Unique identifier for the Item + """ + + cms_locale_id: typing.Optional[str] = pydantic_v1.Field(alias="cmsLocaleId", default=None) + """ + Identifier for the locale of the CMS item + """ + + last_published: typing.Optional[str] = pydantic_v1.Field(alias="lastPublished", default=None) + """ + The date the item was last published + """ + + last_updated: typing.Optional[str] = pydantic_v1.Field(alias="lastUpdated", default=None) + """ + The date the item was last updated + """ + + created_on: typing.Optional[str] = pydantic_v1.Field(alias="createdOn", default=None) + """ + The date the item was created + """ + + is_archived: typing.Optional[bool] = pydantic_v1.Field(alias="isArchived", default=None) + """ + Boolean determining if the Item is set to archived + """ + + is_draft: typing.Optional[bool] = pydantic_v1.Field(alias="isDraft", default=None) + """ + Boolean determining if the Item is set to draft + """ + + field_data: typing.Optional[CollectionItemWithIdInputFieldData] = pydantic_v1.Field(alias="fieldData", default=None) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} + + return deep_union_pydantic_dicts( + super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) + ) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + populate_by_name = True + extra = pydantic_v1.Extra.allow + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/webflow/types/page_details_open_graph.py b/src/webflow/types/collection_item_with_id_input_field_data.py similarity index 57% rename from src/webflow/types/page_details_open_graph.py rename to src/webflow/types/collection_item_with_id_input_field_data.py index 6d82c28..25571c7 100644 --- a/src/webflow/types/page_details_open_graph.py +++ b/src/webflow/types/collection_item_with_id_input_field_data.py @@ -7,29 +7,15 @@ from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 -class PageDetailsOpenGraph(pydantic_v1.BaseModel): +class CollectionItemWithIdInputFieldData(pydantic_v1.BaseModel): + name: typing.Optional[str] = pydantic_v1.Field(default=None) """ - Open Graph fields for the Page + Name of the Item """ - title: typing.Optional[str] = pydantic_v1.Field(default=None) + slug: typing.Optional[str] = pydantic_v1.Field(default=None) """ - The title supplied to Open Graph annotations - """ - - title_copied: typing.Optional[bool] = pydantic_v1.Field(alias="titleCopied", default=None) - """ - Indicates the Open Graph title was copied from the SEO title - """ - - description: typing.Optional[str] = pydantic_v1.Field(default=None) - """ - The description supplied to Open Graph annotations - """ - - description_copied: typing.Optional[bool] = pydantic_v1.Field(alias="descriptionCopied", default=None) - """ - Indicates the Open Graph description was copied from the SEO description + URL structure of the Item in your site. Note: Updates to an item slug will break all links referencing the old slug. """ def json(self, **kwargs: typing.Any) -> str: @@ -47,7 +33,5 @@ def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: class Config: frozen = True smart_union = True - allow_population_by_field_name = True - populate_by_name = True extra = pydantic_v1.Extra.allow json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/webflow/types/custom_code_block.py b/src/webflow/types/custom_code_block.py index 4252be7..5780340 100644 --- a/src/webflow/types/custom_code_block.py +++ b/src/webflow/types/custom_code_block.py @@ -16,12 +16,12 @@ class CustomCodeBlock(pydantic_v1.BaseModel): site_id: typing.Optional[str] = pydantic_v1.Field(alias="siteId", default=None) """ - The Site id where the custom code was applied + The Site ID where the custom code was applied """ page_id: typing.Optional[str] = pydantic_v1.Field(alias="pageId", default=None) """ - The Page id (if applied at Page-level) + The Page ID (if applied at Page-level) """ type: typing.Optional[CustomCodeBlockType] = pydantic_v1.Field(default=None) diff --git a/src/webflow/types/duplicate_user_email.py b/src/webflow/types/duplicate_user_email.py index 31cf125..ea2212f 100644 --- a/src/webflow/types/duplicate_user_email.py +++ b/src/webflow/types/duplicate_user_email.py @@ -1,5 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -from .error import Error +import typing -DuplicateUserEmail = Error +DuplicateUserEmail = typing.Any diff --git a/src/webflow/types/error.py b/src/webflow/types/error.py index ead5b4d..177f47e 100644 --- a/src/webflow/types/error.py +++ b/src/webflow/types/error.py @@ -5,11 +5,12 @@ from ..core.datetime_utils import serialize_datetime from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 +from .error_code import ErrorCode from .error_details_item import ErrorDetailsItem class Error(pydantic_v1.BaseModel): - code: typing.Optional[str] = pydantic_v1.Field(default=None) + code: typing.Optional[ErrorCode] = pydantic_v1.Field(default=None) """ Error code """ diff --git a/src/webflow/types/error_code.py b/src/webflow/types/error_code.py new file mode 100644 index 0000000..69cb50c --- /dev/null +++ b/src/webflow/types/error_code.py @@ -0,0 +1,133 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum +import typing + +T_Result = typing.TypeVar("T_Result") + + +class ErrorCode(str, enum.Enum): + """ + Error code + """ + + BAD_REQUEST = "bad_request" + COLLECTION_NOT_FOUND = "collection_not_found" + CONFLICT = "conflict" + DUPLICATE_COLLECTION = "duplicate_collection" + DUPLICATE_USER_EMAIL = "duplicate_user_email" + ECOMMERCE_NOT_ENABLED = "ecommerce_not_enabled" + FORBIDDEN = "forbidden" + FORMS_REQUIRE_REPUBLISH = "forms_require_republish" + INCOMPATIBLE_WEBHOOK_FILTER = "incompatible_webhook_filter" + INTERNAL_ERROR = "internal_error" + INVALID_AUTH_VERSION = "invalid_auth_version" + INVALID_CREDENTIALS = "invalid_credentials" + INVALID_DOMAIN = "invalid_domain" + INVALID_USER_EMAIL = "invalid_user_email" + ITEM_NOT_FOUND = "item_not_found" + MISSING_SCOPES = "missing_scopes" + NO_DOMAINS = "no_domains" + NOT_AUTHORIZED = "not_authorized" + NOT_ENTERPRISE_PLAN_SITE = "not_enterprise_plan_site" + NOT_ENTERPRISE_PLAN_WORKSPACE = "not_enterprise_plan_workspace" + ORDER_NOT_FOUND = "order_not_found" + RESOURCE_NOT_FOUND = "resource_not_found" + TOO_MANY_REQUESTS = "too_many_requests" + UNSUPPORTED_VERSION = "unsupported_version" + UNSUPPORTED_WEBHOOK_TRIGGER_TYPE = "unsupported_webhook_trigger_type" + USER_LIMIT_REACHED = "user_limit_reached" + USER_NOT_FOUND = "user_not_found" + USERS_NOT_ENABLED = "users_not_enabled" + VALIDATION_ERROR = "validation_error" + + def visit( + self, + bad_request: typing.Callable[[], T_Result], + collection_not_found: typing.Callable[[], T_Result], + conflict: typing.Callable[[], T_Result], + duplicate_collection: typing.Callable[[], T_Result], + duplicate_user_email: typing.Callable[[], T_Result], + ecommerce_not_enabled: typing.Callable[[], T_Result], + forbidden: typing.Callable[[], T_Result], + forms_require_republish: typing.Callable[[], T_Result], + incompatible_webhook_filter: typing.Callable[[], T_Result], + internal_error: typing.Callable[[], T_Result], + invalid_auth_version: typing.Callable[[], T_Result], + invalid_credentials: typing.Callable[[], T_Result], + invalid_domain: typing.Callable[[], T_Result], + invalid_user_email: typing.Callable[[], T_Result], + item_not_found: typing.Callable[[], T_Result], + missing_scopes: typing.Callable[[], T_Result], + no_domains: typing.Callable[[], T_Result], + not_authorized: typing.Callable[[], T_Result], + not_enterprise_plan_site: typing.Callable[[], T_Result], + not_enterprise_plan_workspace: typing.Callable[[], T_Result], + order_not_found: typing.Callable[[], T_Result], + resource_not_found: typing.Callable[[], T_Result], + too_many_requests: typing.Callable[[], T_Result], + unsupported_version: typing.Callable[[], T_Result], + unsupported_webhook_trigger_type: typing.Callable[[], T_Result], + user_limit_reached: typing.Callable[[], T_Result], + user_not_found: typing.Callable[[], T_Result], + users_not_enabled: typing.Callable[[], T_Result], + validation_error: typing.Callable[[], T_Result], + ) -> T_Result: + if self is ErrorCode.BAD_REQUEST: + return bad_request() + if self is ErrorCode.COLLECTION_NOT_FOUND: + return collection_not_found() + if self is ErrorCode.CONFLICT: + return conflict() + if self is ErrorCode.DUPLICATE_COLLECTION: + return duplicate_collection() + if self is ErrorCode.DUPLICATE_USER_EMAIL: + return duplicate_user_email() + if self is ErrorCode.ECOMMERCE_NOT_ENABLED: + return ecommerce_not_enabled() + if self is ErrorCode.FORBIDDEN: + return forbidden() + if self is ErrorCode.FORMS_REQUIRE_REPUBLISH: + return forms_require_republish() + if self is ErrorCode.INCOMPATIBLE_WEBHOOK_FILTER: + return incompatible_webhook_filter() + if self is ErrorCode.INTERNAL_ERROR: + return internal_error() + if self is ErrorCode.INVALID_AUTH_VERSION: + return invalid_auth_version() + if self is ErrorCode.INVALID_CREDENTIALS: + return invalid_credentials() + if self is ErrorCode.INVALID_DOMAIN: + return invalid_domain() + if self is ErrorCode.INVALID_USER_EMAIL: + return invalid_user_email() + if self is ErrorCode.ITEM_NOT_FOUND: + return item_not_found() + if self is ErrorCode.MISSING_SCOPES: + return missing_scopes() + if self is ErrorCode.NO_DOMAINS: + return no_domains() + if self is ErrorCode.NOT_AUTHORIZED: + return not_authorized() + if self is ErrorCode.NOT_ENTERPRISE_PLAN_SITE: + return not_enterprise_plan_site() + if self is ErrorCode.NOT_ENTERPRISE_PLAN_WORKSPACE: + return not_enterprise_plan_workspace() + if self is ErrorCode.ORDER_NOT_FOUND: + return order_not_found() + if self is ErrorCode.RESOURCE_NOT_FOUND: + return resource_not_found() + if self is ErrorCode.TOO_MANY_REQUESTS: + return too_many_requests() + if self is ErrorCode.UNSUPPORTED_VERSION: + return unsupported_version() + if self is ErrorCode.UNSUPPORTED_WEBHOOK_TRIGGER_TYPE: + return unsupported_webhook_trigger_type() + if self is ErrorCode.USER_LIMIT_REACHED: + return user_limit_reached() + if self is ErrorCode.USER_NOT_FOUND: + return user_not_found() + if self is ErrorCode.USERS_NOT_ENABLED: + return users_not_enabled() + if self is ErrorCode.VALIDATION_ERROR: + return validation_error() diff --git a/src/webflow/types/forbidden_error_body.py b/src/webflow/types/forbidden_error_body.py index 7f36dc7..c51ec0f 100644 --- a/src/webflow/types/forbidden_error_body.py +++ b/src/webflow/types/forbidden_error_body.py @@ -1,35 +1,8 @@ # This file was auto-generated by Fern from our API Definition. -import datetime as dt import typing -from ..core.datetime_utils import serialize_datetime -from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 +from .invalid_scopes import InvalidScopes +from .users_not_enabled import UsersNotEnabled - -class ForbiddenErrorBody(pydantic_v1.BaseModel): - status: typing.Optional[int] = None - message: typing.Optional[str] = None - public_error_code: typing.Optional[str] = pydantic_v1.Field(alias="publicErrorCode", default=None) - external_reference: typing.Optional[str] = pydantic_v1.Field(alias="externalReference", default=None) - details: typing.Optional[typing.List[str]] = None - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} - - return deep_union_pydantic_dicts( - super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) - ) - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - populate_by_name = True - extra = pydantic_v1.Extra.allow - json_encoders = {dt.datetime: serialize_datetime} +ForbiddenErrorBody = typing.Union[InvalidScopes, UsersNotEnabled] diff --git a/src/webflow/types/form.py b/src/webflow/types/form.py index ae2a5e7..46ea112 100644 --- a/src/webflow/types/form.py +++ b/src/webflow/types/form.py @@ -29,9 +29,9 @@ class Form(pydantic_v1.BaseModel): Date that the Form was last updated on """ - fields: typing.Optional[typing.List[FormField]] = pydantic_v1.Field(default=None) + fields: typing.Optional[FormField] = pydantic_v1.Field(default=None) """ - A list of form fields + A collection of form field objects """ response_settings: typing.Optional[FormResponseSettings] = pydantic_v1.Field(alias="responseSettings", default=None) @@ -41,22 +41,22 @@ class Form(pydantic_v1.BaseModel): id: typing.Optional[str] = pydantic_v1.Field(default=None) """ - The unique id for the Form + The unique ID for the Form """ site_id: typing.Optional[str] = pydantic_v1.Field(alias="siteId", default=None) """ - The unique id of the Site the Form belongs to + The unique ID of the Site the Form belongs to """ site_domain_id: typing.Optional[str] = pydantic_v1.Field(alias="siteDomainId", default=None) """ - The unique id corresponding to the site's Domain name + The unique ID corresponding to the site's Domain name """ page_id: typing.Optional[str] = pydantic_v1.Field(alias="pageId", default=None) """ - The unique id for the Page on which the Form is placed + The unique ID for the Page on which the Form is placed """ page_name: typing.Optional[str] = pydantic_v1.Field(alias="pageName", default=None) @@ -64,9 +64,14 @@ class Form(pydantic_v1.BaseModel): The user-visible name of the Page where the Form is placed """ + form_element_id: typing.Optional[str] = pydantic_v1.Field(alias="formElementId", default=None) + """ + The unique ID of the Form element + """ + workspace_id: typing.Optional[str] = pydantic_v1.Field(alias="workspaceId", default=None) """ - The unique id of the Workspace the Site belongs to + The unique ID of the Workspace the Site belongs to """ def json(self, **kwargs: typing.Any) -> str: diff --git a/src/webflow/types/form_submission.py b/src/webflow/types/form_submission.py index e55cef3..6ee6a4d 100644 --- a/src/webflow/types/form_submission.py +++ b/src/webflow/types/form_submission.py @@ -10,7 +10,7 @@ class FormSubmission(pydantic_v1.BaseModel): id: typing.Optional[str] = pydantic_v1.Field(default=None) """ - The unique id of the Form submission + The unique ID of the Form submission """ display_name: typing.Optional[str] = pydantic_v1.Field(alias="displayName", default=None) @@ -20,12 +20,12 @@ class FormSubmission(pydantic_v1.BaseModel): site_id: typing.Optional[str] = pydantic_v1.Field(alias="siteId", default=None) """ - The unique id of the Site the Form belongs to + The unique ID of the Site the Form belongs to """ workspace_id: typing.Optional[str] = pydantic_v1.Field(alias="workspaceId", default=None) """ - The unique id of the Workspace the Site belongs to + The unique ID of the Workspace the Site belongs to """ date_submitted: typing.Optional[dt.datetime] = pydantic_v1.Field(alias="dateSubmitted", default=None) diff --git a/src/webflow/types/form_submission_list.py b/src/webflow/types/form_submission_list.py index 6222a6a..08fb699 100644 --- a/src/webflow/types/form_submission_list.py +++ b/src/webflow/types/form_submission_list.py @@ -10,7 +10,9 @@ class FormSubmissionList(pydantic_v1.BaseModel): - submissions: typing.Optional[typing.List[FormSubmission]] = None + form_submissions: typing.Optional[typing.List[FormSubmission]] = pydantic_v1.Field( + alias="formSubmissions", default=None + ) pagination: typing.Optional[Pagination] = None def json(self, **kwargs: typing.Any) -> str: @@ -28,5 +30,7 @@ def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: class Config: frozen = True smart_union = True + allow_population_by_field_name = True + populate_by_name = True extra = pydantic_v1.Extra.allow json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/webflow/types/missing_scopes.py b/src/webflow/types/invalid_scopes.py similarity index 58% rename from src/webflow/types/missing_scopes.py rename to src/webflow/types/invalid_scopes.py index a3b4b3e..babfdd3 100644 --- a/src/webflow/types/missing_scopes.py +++ b/src/webflow/types/invalid_scopes.py @@ -1,5 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -from .error import Error +import typing -MissingScopes = Error +InvalidScopes = typing.Any diff --git a/src/webflow/types/not_enterprise_plan_site.py b/src/webflow/types/not_enterprise_plan_site.py index 41410c6..1001cf8 100644 --- a/src/webflow/types/not_enterprise_plan_site.py +++ b/src/webflow/types/not_enterprise_plan_site.py @@ -1,5 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -from .error import Error +import typing -NotEnterprisePlanSite = Error +NotEnterprisePlanSite = typing.Any diff --git a/src/webflow/types/oauth_scope.py b/src/webflow/types/oauth_scope.py deleted file mode 100644 index 59ad0fd..0000000 --- a/src/webflow/types/oauth_scope.py +++ /dev/null @@ -1,172 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import enum -import typing - -T_Result = typing.TypeVar("T_Result") - - -class OauthScope(str, enum.Enum): - AUTHORIZED_USER_READ = "authorized_user:read" - """ - read details about the authorized user - """ - - ASSETS_READ = "assets:read" - """ - read assets on the site - """ - - ASSETS_WRITE = "assets:write" - """ - write assets on a site - """ - - CMS_READ = "cms:read" - """ - read collections and items for a site - """ - - CMS_WRITE = "cms:write" - """ - write to collections and items for a site - """ - - CUSTOM_CODE_READ = "custom_code:read" - """ - read custom code on the site - """ - - CUSTOM_CODE_WRITE = "custom_code:write" - """ - modify custom code on the site - """ - - ECOMMERCE_READ = "ecommerce:read" - """ - read ecommerce data - """ - - ECOMMERCE_WRITE = "ecommerce:write" - """ - edit ecommerce data - """ - - FORMS_READ = "forms:read" - """ - read form data - """ - - FORMS_WRITE = "forms:write" - """ - write form data - """ - - PAGES_READ = "pages:read" - """ - read pages on the site - """ - - PAGES_WRITE = "pages:write" - """ - write to pages on the site - """ - - SITES_READ = "sites:read" - """ - read sites on the site - """ - - SITES_WRITE = "sites:write" - """ - modify pages on the site - """ - - USERS_READ = "users:read" - """ - read users on the site - """ - - SITE_ACTIVITY_READ = "site_activity:read" - """ - read site activity logs - """ - - USERS_WRITE = "users:write" - """ - modify users on the site - """ - - WORKSPACE_READ = "workspace:read" - """ - read workspace resource data - """ - - WORKSPACE_WRITE = "workspace:write" - """ - write workspace resource data - """ - - def visit( - self, - authorized_user_read: typing.Callable[[], T_Result], - assets_read: typing.Callable[[], T_Result], - assets_write: typing.Callable[[], T_Result], - cms_read: typing.Callable[[], T_Result], - cms_write: typing.Callable[[], T_Result], - custom_code_read: typing.Callable[[], T_Result], - custom_code_write: typing.Callable[[], T_Result], - ecommerce_read: typing.Callable[[], T_Result], - ecommerce_write: typing.Callable[[], T_Result], - forms_read: typing.Callable[[], T_Result], - forms_write: typing.Callable[[], T_Result], - pages_read: typing.Callable[[], T_Result], - pages_write: typing.Callable[[], T_Result], - sites_read: typing.Callable[[], T_Result], - sites_write: typing.Callable[[], T_Result], - users_read: typing.Callable[[], T_Result], - site_activity_read: typing.Callable[[], T_Result], - users_write: typing.Callable[[], T_Result], - workspace_read: typing.Callable[[], T_Result], - workspace_write: typing.Callable[[], T_Result], - ) -> T_Result: - if self is OauthScope.AUTHORIZED_USER_READ: - return authorized_user_read() - if self is OauthScope.ASSETS_READ: - return assets_read() - if self is OauthScope.ASSETS_WRITE: - return assets_write() - if self is OauthScope.CMS_READ: - return cms_read() - if self is OauthScope.CMS_WRITE: - return cms_write() - if self is OauthScope.CUSTOM_CODE_READ: - return custom_code_read() - if self is OauthScope.CUSTOM_CODE_WRITE: - return custom_code_write() - if self is OauthScope.ECOMMERCE_READ: - return ecommerce_read() - if self is OauthScope.ECOMMERCE_WRITE: - return ecommerce_write() - if self is OauthScope.FORMS_READ: - return forms_read() - if self is OauthScope.FORMS_WRITE: - return forms_write() - if self is OauthScope.PAGES_READ: - return pages_read() - if self is OauthScope.PAGES_WRITE: - return pages_write() - if self is OauthScope.SITES_READ: - return sites_read() - if self is OauthScope.SITES_WRITE: - return sites_write() - if self is OauthScope.USERS_READ: - return users_read() - if self is OauthScope.SITE_ACTIVITY_READ: - return site_activity_read() - if self is OauthScope.USERS_WRITE: - return users_write() - if self is OauthScope.WORKSPACE_READ: - return workspace_read() - if self is OauthScope.WORKSPACE_WRITE: - return workspace_write() diff --git a/src/webflow/types/order.py b/src/webflow/types/order.py index f4be90d..fafec24 100644 --- a/src/webflow/types/order.py +++ b/src/webflow/types/order.py @@ -22,7 +22,9 @@ class Order(pydantic_v1.BaseModel): order_id: typing.Optional[str] = pydantic_v1.Field(alias="orderId", default=None) """ - The order id. Will usually be 6 hex characters, but can also be 9 hex characters if the site has a very large number of Orders. Randomly assigned. + The order ID. Will usually be 6 hex characters, but can also be 9 + hex characters if the site has a very large number of Orders. + Randomly assigned. """ status: typing.Optional[OrderStatus] = pydantic_v1.Field(default=None) diff --git a/src/webflow/types/page.py b/src/webflow/types/page.py index 4995ea4..244dbce 100644 --- a/src/webflow/types/page.py +++ b/src/webflow/types/page.py @@ -14,7 +14,7 @@ class Page(pydantic_v1.BaseModel): The Page object """ - id: typing.Optional[str] = pydantic_v1.Field(default=None) + id: str = pydantic_v1.Field() """ Unique identifier for the Page """ @@ -69,6 +69,11 @@ class Page(pydantic_v1.BaseModel): Indicates whether the Page supports [Page Branching](https://university.webflow.com/lesson/page-branching) """ + is_branch: typing.Optional[bool] = pydantic_v1.Field(alias="isBranch", default=None) + """ + Indicates whether the Page is a Branch of another Page [Page Branching](https://university.webflow.com/lesson/page-branching) + """ + is_members_only: typing.Optional[bool] = pydantic_v1.Field(alias="isMembersOnly", default=None) """ Indicates whether the Page is restricted by [Memberships Controls](https://university.webflow.com/lesson/webflow-memberships-overview#how-to-manage-page-restrictions) @@ -84,6 +89,16 @@ class Page(pydantic_v1.BaseModel): Open Graph fields for the Page """ + locale_id: typing.Optional[str] = pydantic_v1.Field(alias="localeId", default=None) + """ + Unique ID of the page locale + """ + + published_path: typing.Optional[str] = pydantic_v1.Field(alias="publishedPath", default=None) + """ + Relative path of the published page URL + """ + def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} return super().json(**kwargs_with_defaults) diff --git a/src/webflow/types/page_details.py b/src/webflow/types/page_details.py deleted file mode 100644 index 6efa48e..0000000 --- a/src/webflow/types/page_details.py +++ /dev/null @@ -1,115 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -from ..core.datetime_utils import serialize_datetime -from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 -from .page_details_open_graph import PageDetailsOpenGraph -from .page_details_seo import PageDetailsSeo - - -class PageDetails(pydantic_v1.BaseModel): - """ - The Page object - """ - - id: typing.Optional[str] = pydantic_v1.Field(default=None) - """ - Unique identifier for the Page - """ - - site_id: typing.Optional[str] = pydantic_v1.Field(alias="siteId", default=None) - """ - Unique identifier for the Site - """ - - title: typing.Optional[str] = pydantic_v1.Field(default=None) - """ - Title of the Page - """ - - slug: typing.Optional[str] = pydantic_v1.Field(default=None) - """ - slug of the Page (derived from title) - """ - - parent_id: typing.Optional[str] = pydantic_v1.Field(alias="parentId", default=None) - """ - Identifier of the parent folder - """ - - collection_id: typing.Optional[str] = pydantic_v1.Field(alias="collectionId", default=None) - """ - Unique identifier for a linked Collection, value will be null if the Page is not part of a Collection. - """ - - created_on: typing.Optional[dt.datetime] = pydantic_v1.Field(alias="createdOn", default=None) - """ - The date the Page was created - """ - - last_updated: typing.Optional[dt.datetime] = pydantic_v1.Field(alias="lastUpdated", default=None) - """ - The date the Page was most recently updated - """ - - archived: typing.Optional[bool] = pydantic_v1.Field(default=None) - """ - Whether the Page has been archived - """ - - draft: typing.Optional[bool] = pydantic_v1.Field(default=None) - """ - Whether the Page is a draft - """ - - can_branch: typing.Optional[bool] = pydantic_v1.Field(alias="canBranch", default=None) - """ - Indicates whether the Page supports [Page Branching](https://university.webflow.com/lesson/page-branching) - """ - - is_members_only: typing.Optional[bool] = pydantic_v1.Field(alias="isMembersOnly", default=None) - """ - Indicates whether the Page is restricted by [Memberships Controls](https://university.webflow.com/lesson/webflow-memberships-overview#how-to-manage-page-restrictions) - """ - - seo: typing.Optional[PageDetailsSeo] = pydantic_v1.Field(default=None) - """ - SEO-related fields for the Page - """ - - open_graph: typing.Optional[PageDetailsOpenGraph] = pydantic_v1.Field(alias="openGraph", default=None) - """ - Open Graph fields for the Page - """ - - locale_id: typing.Optional[str] = pydantic_v1.Field(alias="localeId", default=None) - """ - Unique ID of the page locale - """ - - published_path: typing.Optional[str] = pydantic_v1.Field(alias="publishedPath", default=None) - """ - Relative path of the published page URL - """ - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} - - return deep_union_pydantic_dicts( - super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) - ) - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - populate_by_name = True - extra = pydantic_v1.Extra.allow - json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/webflow/types/site.py b/src/webflow/types/site.py index f00321f..ba0b082 100644 --- a/src/webflow/types/site.py +++ b/src/webflow/types/site.py @@ -7,6 +7,7 @@ from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 from .domain import Domain from .locales import Locales +from .site_data_collection_type import SiteDataCollectionType class Site(pydantic_v1.BaseModel): @@ -62,6 +63,17 @@ class Site(pydantic_v1.BaseModel): custom_domains: typing.Optional[typing.List[Domain]] = pydantic_v1.Field(alias="customDomains", default=None) locales: typing.Optional[Locales] = None + data_collection_enabled: typing.Optional[bool] = pydantic_v1.Field(alias="dataCollectionEnabled", default=None) + """ + Indicates if data collection is enabled for the site. + """ + + data_collection_type: typing.Optional[SiteDataCollectionType] = pydantic_v1.Field( + alias="dataCollectionType", default=None + ) + """ + The type of data collection enabled for the site. + """ def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/src/webflow/types/site_activity_log_item.py b/src/webflow/types/site_activity_log_item.py index a23608c..8827cef 100644 --- a/src/webflow/types/site_activity_log_item.py +++ b/src/webflow/types/site_activity_log_item.py @@ -5,6 +5,7 @@ from ..core.datetime_utils import serialize_datetime from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 +from .site_activity_log_item_event import SiteActivityLogItemEvent from .site_activity_log_item_resource_operation import SiteActivityLogItemResourceOperation from .site_activity_log_item_user import SiteActivityLogItemUser @@ -13,7 +14,7 @@ class SiteActivityLogItem(pydantic_v1.BaseModel): id: typing.Optional[str] = None created_on: typing.Optional[dt.datetime] = pydantic_v1.Field(alias="createdOn", default=None) last_updated: typing.Optional[dt.datetime] = pydantic_v1.Field(alias="lastUpdated", default=None) - event: typing.Optional[str] = None + event: typing.Optional[SiteActivityLogItemEvent] = None resource_operation: typing.Optional[SiteActivityLogItemResourceOperation] = pydantic_v1.Field( alias="resourceOperation", default=None ) diff --git a/src/webflow/types/site_activity_log_item_event.py b/src/webflow/types/site_activity_log_item_event.py new file mode 100644 index 0000000..dc40f80 --- /dev/null +++ b/src/webflow/types/site_activity_log_item_event.py @@ -0,0 +1,181 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum +import typing + +T_Result = typing.TypeVar("T_Result") + + +class SiteActivityLogItemEvent(str, enum.Enum): + STYLES_MODIFIED = "styles_modified" + SITE_PUBLISHED = "site_published" + IX_2_MODIFIED_ON_PAGE = "ix2_modified_on_page" + PAGE_DOM_MODIFIED = "page_dom_modified" + CMS_ITEM = "cms_item" + BACKUP_CREATED = "backup_created" + PAGE_CUSTOM_CODE_MODIFIED = "page_custom_code_modified" + SYMBOLS_MODIFIED = "symbols_modified" + VARIABLE_MODIFIED = "variable_modified" + VARIABLES_MODIFIED = "variables_modified" + CMS_COLLECTION = "cms_collection" + PAGE_SETTINGS_MODIFIED = "page_settings_modified" + PAGE_SETTINGS_CUSTOM_CODE_MODIFIED = "page_settings_custom_code_modified" + IX_2_MODIFIED_ON_COMPONENT = "ix2_modified_on_component" + IX_2_MODIFIED_ON_CLASS = "ix2_modified_on_class" + SITE_CUSTOM_CODE_MODIFIED = "site_custom_code_modified" + PAGE_DUPLICATED = "page_duplicated" + SECONDARY_LOCALE_PAGE_CONTENT_MODIFIED = "secondary_locale_page_content_modified" + PAGE_RENAMED = "page_renamed" + PAGE_CREATED = "page_created" + PAGE_DELETED = "page_deleted" + SITE_UNPUBLISHED = "site_unpublished" + BACKUP_RESTORED = "backup_restored" + LOCALE_ADDED = "locale_added" + BRANCH_CREATED = "branch_created" + LOCALE_DISPLAY_NAME_UPDATED = "locale_display_name_updated" + LOCALE_SUBDIRECTORY_UPDATED = "locale_subdirectory_updated" + BRANCH_MERGED = "branch_merged" + LOCALE_TAG_UPDATED = "locale_tag_updated" + BRANCH_DELETED = "branch_deleted" + LOCALE_ENABLED = "locale_enabled" + LOCALE_REMOVED = "locale_removed" + LOCALE_DISABLED = "locale_disabled" + LIBRARY_SHARED = "library_shared" + LIBRARY_UNSHARED = "library_unshared" + LIBRARY_INSTALLED = "library_installed" + LIBRARY_UNINSTALLED = "library_uninstalled" + LIBRARY_UPDATE_SHARED = "library_update_shared" + LIBRARY_UPDATE_ACCEPTED = "library_update_accepted" + BRANCH_REVIEW_CREATED = "branch_review_created" + BRANCH_REVIEW_APPROVED = "branch_review_approved" + BRANCH_REVIEW_CANCELED = "branch_review_canceled" + + def visit( + self, + styles_modified: typing.Callable[[], T_Result], + site_published: typing.Callable[[], T_Result], + ix_2_modified_on_page: typing.Callable[[], T_Result], + page_dom_modified: typing.Callable[[], T_Result], + cms_item: typing.Callable[[], T_Result], + backup_created: typing.Callable[[], T_Result], + page_custom_code_modified: typing.Callable[[], T_Result], + symbols_modified: typing.Callable[[], T_Result], + variable_modified: typing.Callable[[], T_Result], + variables_modified: typing.Callable[[], T_Result], + cms_collection: typing.Callable[[], T_Result], + page_settings_modified: typing.Callable[[], T_Result], + page_settings_custom_code_modified: typing.Callable[[], T_Result], + ix_2_modified_on_component: typing.Callable[[], T_Result], + ix_2_modified_on_class: typing.Callable[[], T_Result], + site_custom_code_modified: typing.Callable[[], T_Result], + page_duplicated: typing.Callable[[], T_Result], + secondary_locale_page_content_modified: typing.Callable[[], T_Result], + page_renamed: typing.Callable[[], T_Result], + page_created: typing.Callable[[], T_Result], + page_deleted: typing.Callable[[], T_Result], + site_unpublished: typing.Callable[[], T_Result], + backup_restored: typing.Callable[[], T_Result], + locale_added: typing.Callable[[], T_Result], + branch_created: typing.Callable[[], T_Result], + locale_display_name_updated: typing.Callable[[], T_Result], + locale_subdirectory_updated: typing.Callable[[], T_Result], + branch_merged: typing.Callable[[], T_Result], + locale_tag_updated: typing.Callable[[], T_Result], + branch_deleted: typing.Callable[[], T_Result], + locale_enabled: typing.Callable[[], T_Result], + locale_removed: typing.Callable[[], T_Result], + locale_disabled: typing.Callable[[], T_Result], + library_shared: typing.Callable[[], T_Result], + library_unshared: typing.Callable[[], T_Result], + library_installed: typing.Callable[[], T_Result], + library_uninstalled: typing.Callable[[], T_Result], + library_update_shared: typing.Callable[[], T_Result], + library_update_accepted: typing.Callable[[], T_Result], + branch_review_created: typing.Callable[[], T_Result], + branch_review_approved: typing.Callable[[], T_Result], + branch_review_canceled: typing.Callable[[], T_Result], + ) -> T_Result: + if self is SiteActivityLogItemEvent.STYLES_MODIFIED: + return styles_modified() + if self is SiteActivityLogItemEvent.SITE_PUBLISHED: + return site_published() + if self is SiteActivityLogItemEvent.IX_2_MODIFIED_ON_PAGE: + return ix_2_modified_on_page() + if self is SiteActivityLogItemEvent.PAGE_DOM_MODIFIED: + return page_dom_modified() + if self is SiteActivityLogItemEvent.CMS_ITEM: + return cms_item() + if self is SiteActivityLogItemEvent.BACKUP_CREATED: + return backup_created() + if self is SiteActivityLogItemEvent.PAGE_CUSTOM_CODE_MODIFIED: + return page_custom_code_modified() + if self is SiteActivityLogItemEvent.SYMBOLS_MODIFIED: + return symbols_modified() + if self is SiteActivityLogItemEvent.VARIABLE_MODIFIED: + return variable_modified() + if self is SiteActivityLogItemEvent.VARIABLES_MODIFIED: + return variables_modified() + if self is SiteActivityLogItemEvent.CMS_COLLECTION: + return cms_collection() + if self is SiteActivityLogItemEvent.PAGE_SETTINGS_MODIFIED: + return page_settings_modified() + if self is SiteActivityLogItemEvent.PAGE_SETTINGS_CUSTOM_CODE_MODIFIED: + return page_settings_custom_code_modified() + if self is SiteActivityLogItemEvent.IX_2_MODIFIED_ON_COMPONENT: + return ix_2_modified_on_component() + if self is SiteActivityLogItemEvent.IX_2_MODIFIED_ON_CLASS: + return ix_2_modified_on_class() + if self is SiteActivityLogItemEvent.SITE_CUSTOM_CODE_MODIFIED: + return site_custom_code_modified() + if self is SiteActivityLogItemEvent.PAGE_DUPLICATED: + return page_duplicated() + if self is SiteActivityLogItemEvent.SECONDARY_LOCALE_PAGE_CONTENT_MODIFIED: + return secondary_locale_page_content_modified() + if self is SiteActivityLogItemEvent.PAGE_RENAMED: + return page_renamed() + if self is SiteActivityLogItemEvent.PAGE_CREATED: + return page_created() + if self is SiteActivityLogItemEvent.PAGE_DELETED: + return page_deleted() + if self is SiteActivityLogItemEvent.SITE_UNPUBLISHED: + return site_unpublished() + if self is SiteActivityLogItemEvent.BACKUP_RESTORED: + return backup_restored() + if self is SiteActivityLogItemEvent.LOCALE_ADDED: + return locale_added() + if self is SiteActivityLogItemEvent.BRANCH_CREATED: + return branch_created() + if self is SiteActivityLogItemEvent.LOCALE_DISPLAY_NAME_UPDATED: + return locale_display_name_updated() + if self is SiteActivityLogItemEvent.LOCALE_SUBDIRECTORY_UPDATED: + return locale_subdirectory_updated() + if self is SiteActivityLogItemEvent.BRANCH_MERGED: + return branch_merged() + if self is SiteActivityLogItemEvent.LOCALE_TAG_UPDATED: + return locale_tag_updated() + if self is SiteActivityLogItemEvent.BRANCH_DELETED: + return branch_deleted() + if self is SiteActivityLogItemEvent.LOCALE_ENABLED: + return locale_enabled() + if self is SiteActivityLogItemEvent.LOCALE_REMOVED: + return locale_removed() + if self is SiteActivityLogItemEvent.LOCALE_DISABLED: + return locale_disabled() + if self is SiteActivityLogItemEvent.LIBRARY_SHARED: + return library_shared() + if self is SiteActivityLogItemEvent.LIBRARY_UNSHARED: + return library_unshared() + if self is SiteActivityLogItemEvent.LIBRARY_INSTALLED: + return library_installed() + if self is SiteActivityLogItemEvent.LIBRARY_UNINSTALLED: + return library_uninstalled() + if self is SiteActivityLogItemEvent.LIBRARY_UPDATE_SHARED: + return library_update_shared() + if self is SiteActivityLogItemEvent.LIBRARY_UPDATE_ACCEPTED: + return library_update_accepted() + if self is SiteActivityLogItemEvent.BRANCH_REVIEW_CREATED: + return branch_review_created() + if self is SiteActivityLogItemEvent.BRANCH_REVIEW_APPROVED: + return branch_review_approved() + if self is SiteActivityLogItemEvent.BRANCH_REVIEW_CANCELED: + return branch_review_canceled() diff --git a/src/webflow/types/site_activity_log_item_resource_operation.py b/src/webflow/types/site_activity_log_item_resource_operation.py index fef8208..bff0af3 100644 --- a/src/webflow/types/site_activity_log_item_resource_operation.py +++ b/src/webflow/types/site_activity_log_item_resource_operation.py @@ -12,6 +12,10 @@ class SiteActivityLogItemResourceOperation(str, enum.Enum): PUBLISHED = "PUBLISHED" UNPUBLISHED = "UNPUBLISHED" DELETED = "DELETED" + GROUP_REORDERED = "GROUP_REORDERED" + GROUP_CREATED = "GROUP_CREATED" + GROUP_DELETED = "GROUP_DELETED" + REORDERED = "REORDERED" def visit( self, @@ -20,6 +24,10 @@ def visit( published: typing.Callable[[], T_Result], unpublished: typing.Callable[[], T_Result], deleted: typing.Callable[[], T_Result], + group_reordered: typing.Callable[[], T_Result], + group_created: typing.Callable[[], T_Result], + group_deleted: typing.Callable[[], T_Result], + reordered: typing.Callable[[], T_Result], ) -> T_Result: if self is SiteActivityLogItemResourceOperation.CREATED: return created() @@ -31,3 +39,11 @@ def visit( return unpublished() if self is SiteActivityLogItemResourceOperation.DELETED: return deleted() + if self is SiteActivityLogItemResourceOperation.GROUP_REORDERED: + return group_reordered() + if self is SiteActivityLogItemResourceOperation.GROUP_CREATED: + return group_created() + if self is SiteActivityLogItemResourceOperation.GROUP_DELETED: + return group_deleted() + if self is SiteActivityLogItemResourceOperation.REORDERED: + return reordered() diff --git a/src/webflow/types/site_data_collection_type.py b/src/webflow/types/site_data_collection_type.py new file mode 100644 index 0000000..a0c82a9 --- /dev/null +++ b/src/webflow/types/site_data_collection_type.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum +import typing + +T_Result = typing.TypeVar("T_Result") + + +class SiteDataCollectionType(str, enum.Enum): + """ + The type of data collection enabled for the site. + """ + + ALWAYS = "always" + OPT_OUT = "optOut" + DISABLED = "disabled" + + def visit( + self, + always: typing.Callable[[], T_Result], + opt_out: typing.Callable[[], T_Result], + disabled: typing.Callable[[], T_Result], + ) -> T_Result: + if self is SiteDataCollectionType.ALWAYS: + return always() + if self is SiteDataCollectionType.OPT_OUT: + return opt_out() + if self is SiteDataCollectionType.DISABLED: + return disabled() diff --git a/src/webflow/types/user_limit_reached.py b/src/webflow/types/user_limit_reached.py index 62b0412..4fdcd9b 100644 --- a/src/webflow/types/user_limit_reached.py +++ b/src/webflow/types/user_limit_reached.py @@ -1,5 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -from .error import Error +import typing -UserLimitReached = Error +UserLimitReached = typing.Any diff --git a/src/webflow/types/users_not_enabled.py b/src/webflow/types/users_not_enabled.py index 2d9b8d6..041f9b1 100644 --- a/src/webflow/types/users_not_enabled.py +++ b/src/webflow/types/users_not_enabled.py @@ -1,5 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -from .error import Error +import typing -UsersNotEnabled = Error +UsersNotEnabled = typing.Any diff --git a/src/webflow/types/webhook.py b/src/webflow/types/webhook.py index 9697dfb..af27c22 100644 --- a/src/webflow/types/webhook.py +++ b/src/webflow/types/webhook.py @@ -6,6 +6,7 @@ from ..core.datetime_utils import serialize_datetime from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 from .trigger_type import TriggerType +from .webhook_filter import WebhookFilter class Webhook(pydantic_v1.BaseModel): @@ -14,6 +15,12 @@ class Webhook(pydantic_v1.BaseModel): Unique identifier for the Webhook registration """ + trigger_type: typing.Optional[TriggerType] = pydantic_v1.Field(alias="triggerType", default=None) + url: typing.Optional[str] = pydantic_v1.Field(default=None) + """ + URL to send the Webhook payload to + """ + workspace_id: typing.Optional[str] = pydantic_v1.Field(alias="workspaceId", default=None) """ Unique identifier for the Workspace the Webhook is registered in @@ -24,10 +31,9 @@ class Webhook(pydantic_v1.BaseModel): Unique identifier for the Site the Webhook is registered in """ - trigger_type: typing.Optional[TriggerType] = pydantic_v1.Field(alias="triggerType", default=None) - filter: typing.Optional[typing.Dict[str, typing.Any]] = pydantic_v1.Field(default=None) + filter: typing.Optional[WebhookFilter] = pydantic_v1.Field(default=None) """ - Filter for selecting which events you want Webhooks to be sent for. Only supported for form_submission trigger types. + Only supported for the `form_submission` trigger type. Filter for the form you want Webhooks to be sent for. """ last_triggered: typing.Optional[dt.datetime] = pydantic_v1.Field(alias="lastTriggered", default=None) @@ -40,11 +46,6 @@ class Webhook(pydantic_v1.BaseModel): Date the Webhook registration was created """ - url: typing.Optional[str] = pydantic_v1.Field(default=None) - """ - URL to send the Webhook payload to - """ - def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} return super().json(**kwargs_with_defaults) diff --git a/src/webflow/types/webhook_filter.py b/src/webflow/types/webhook_filter.py new file mode 100644 index 0000000..1772941 --- /dev/null +++ b/src/webflow/types/webhook_filter.py @@ -0,0 +1,36 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ..core.datetime_utils import serialize_datetime +from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 + + +class WebhookFilter(pydantic_v1.BaseModel): + """ + Only supported for the `form_submission` trigger type. Filter for the form you want Webhooks to be sent for. + """ + + name: typing.Optional[str] = pydantic_v1.Field(default=None) + """ + The name of the form you'd like to recieve notifications for. + """ + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} + + return deep_union_pydantic_dicts( + super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) + ) + + class Config: + frozen = True + smart_union = True + extra = pydantic_v1.Extra.allow + json_encoders = {dt.datetime: serialize_datetime} diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..f3ea265 --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1,2 @@ +# This file was auto-generated by Fern from our API Definition. + diff --git a/tests/collections/__init__.py b/tests/collections/__init__.py new file mode 100644 index 0000000..f3ea265 --- /dev/null +++ b/tests/collections/__init__.py @@ -0,0 +1,2 @@ +# This file was auto-generated by Fern from our API Definition. + diff --git a/tests/collections/test_fields.py b/tests/collections/test_fields.py new file mode 100644 index 0000000..7f8781b --- /dev/null +++ b/tests/collections/test_fields.py @@ -0,0 +1,91 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from webflow.client import AsyncWebflow, Webflow +from webflow.resources.collections import FieldCreateType + +from ..utilities import validate_response + + +async def test_create(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "id": "75821f618da60c18383330bcc0ca488b", + "isRequired": False, + "isEditable": True, + "type": "RichText", + "slug": "post-body", + "displayName": "Post Body", + "helpText": "Add the body of your post here", + } + expected_types: typing.Any = { + "id": None, + "isRequired": None, + "isEditable": None, + "type": None, + "slug": None, + "displayName": None, + "helpText": None, + } + response = client.collections.fields.create( + collection_id="580e63fc8c9a982ac9b8b745", + is_required=False, + type=FieldCreateType.RICH_TEXT, + display_name="Post Body", + help_text="Add the body of your post here", + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.collections.fields.create( + collection_id="580e63fc8c9a982ac9b8b745", + is_required=False, + type=FieldCreateType.RICH_TEXT, + display_name="Post Body", + help_text="Add the body of your post here", + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_delete(client: Webflow, async_client: AsyncWebflow) -> None: + # Type ignore to avoid mypy complaining about the function not being meant to return a value + assert client.collections.fields.delete(collection_id="580e63fc8c9a982ac9b8b745", field_id="580e63fc8c9a982ac9b8b745") is None # type: ignore[func-returns-value] + + assert await async_client.collections.fields.delete(collection_id="580e63fc8c9a982ac9b8b745", field_id="580e63fc8c9a982ac9b8b745") is None # type: ignore[func-returns-value] + + +async def test_update(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "id": "75821f618da60c18383330bcc0ca488b", + "isRequired": False, + "isEditable": True, + "type": "RichText", + "slug": "post-body", + "displayName": "Post Body", + "helpText": "Add the body of your post here", + } + expected_types: typing.Any = { + "id": None, + "isRequired": None, + "isEditable": None, + "type": None, + "slug": None, + "displayName": None, + "helpText": None, + } + response = client.collections.fields.update( + collection_id="580e63fc8c9a982ac9b8b745", + field_id="580e63fc8c9a982ac9b8b745", + is_required=False, + display_name="Post Body", + help_text="Add the body of your post here", + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.collections.fields.update( + collection_id="580e63fc8c9a982ac9b8b745", + field_id="580e63fc8c9a982ac9b8b745", + is_required=False, + display_name="Post Body", + help_text="Add the body of your post here", + ) + validate_response(async_response, expected_response, expected_types) diff --git a/tests/collections/test_items.py b/tests/collections/test_items.py new file mode 100644 index 0000000..f1a4d87 --- /dev/null +++ b/tests/collections/test_items.py @@ -0,0 +1,705 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from webflow import ( + CollectionItem, + CollectionItemFieldData, + CollectionItemPatchSingleFieldData, + CollectionItemPostSingle, + CollectionItemPostSingleFieldData, + CollectionItemWithIdInput, + CollectionItemWithIdInputFieldData, +) +from webflow.client import AsyncWebflow, Webflow +from webflow.resources.collections import SingleCmsItem + +from ..utilities import validate_response + + +async def test_list_items(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "items": [ + { + "id": "62b720ef280c7a7a3be8cabe", + "cmsLocaleId": "66f6e966c9e1dc700a857ca3", + "lastPublished": "2022-06-30T13:35:20.878Z", + "lastUpdated": "2022-06-25T14:51:27.809Z", + "createdOn": "2022-06-25T14:51:27.809Z", + "isArchived": False, + "isDraft": False, + "fieldData": {"name": "Senior Data Analyst", "slug": "senior-data-analyst"}, + }, + { + "id": "62c880ef281c7b7b4cf9dabc", + "cmsLocaleId": "66f6e966c9e1dc700a857ca3", + "lastPublished": "2023-04-15T10:25:18.123Z", + "lastUpdated": "2023-04-10T11:45:30.567Z", + "createdOn": "2023-04-10T11:45:30.567Z", + "isArchived": False, + "isDraft": False, + "fieldData": {"name": "Product Manager", "slug": "product-manager"}, + }, + ], + "pagination": {"limit": 25, "offset": 0, "total": 2}, + } + expected_types: typing.Any = { + "items": ( + "list", + { + 0: { + "id": None, + "cmsLocaleId": None, + "lastPublished": None, + "lastUpdated": None, + "createdOn": None, + "isArchived": None, + "isDraft": None, + "fieldData": {"name": None, "slug": None}, + }, + 1: { + "id": None, + "cmsLocaleId": None, + "lastPublished": None, + "lastUpdated": None, + "createdOn": None, + "isArchived": None, + "isDraft": None, + "fieldData": {"name": None, "slug": None}, + }, + }, + ), + "pagination": {"limit": None, "offset": None, "total": None}, + } + response = client.collections.items.list_items(collection_id="580e63fc8c9a982ac9b8b745") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.collections.items.list_items(collection_id="580e63fc8c9a982ac9b8b745") + validate_response(async_response, expected_response, expected_types) + + +async def test_create_item(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "id": "42b720ef280c7a7a3be8cabe", + "cmsLocaleId": "653ad57de882f528b32e810e", + "lastPublished": "2022-11-29T16:22:43.159Z", + "lastUpdated": "2022-11-17T17:19:43.282Z", + "createdOn": "2022-11-17T17:11:57.148Z", + "isArchived": False, + "isDraft": False, + "fieldData": {"name": "Pan Galactic Gargle Blaster Recipe", "slug": "pan-galactic-gargle-blaster"}, + } + expected_types: typing.Any = { + "id": None, + "cmsLocaleId": None, + "lastPublished": None, + "lastUpdated": None, + "createdOn": None, + "isArchived": None, + "isDraft": None, + "fieldData": {"name": None, "slug": None}, + } + response = client.collections.items.create_item( + collection_id="580e63fc8c9a982ac9b8b745", + request=CollectionItemPostSingle( + is_archived=False, + is_draft=False, + field_data=CollectionItemPostSingleFieldData( + name="Pan Galactic Gargle Blaster Recipe", slug="pan-galactic-gargle-blaster" + ), + ), + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.collections.items.create_item( + collection_id="580e63fc8c9a982ac9b8b745", + request=CollectionItemPostSingle( + is_archived=False, + is_draft=False, + field_data=CollectionItemPostSingleFieldData( + name="Pan Galactic Gargle Blaster Recipe", slug="pan-galactic-gargle-blaster" + ), + ), + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_delete_items(client: Webflow, async_client: AsyncWebflow) -> None: + # Type ignore to avoid mypy complaining about the function not being meant to return a value + assert client.collections.items.delete_items(collection_id="580e63fc8c9a982ac9b8b745") is None # type: ignore[func-returns-value] + + assert await async_client.collections.items.delete_items(collection_id="580e63fc8c9a982ac9b8b745") is None # type: ignore[func-returns-value] + + +async def test_update_items(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "id": "id", + "cmsLocaleId": "653ad57de882f528b32e810e", + "lastPublished": "2023-03-17T18:47:35.560Z", + "lastUpdated": "2023-03-17T18:47:35.560Z", + "createdOn": "2023-03-17T18:47:35.560Z", + "isArchived": True, + "isDraft": True, + "fieldData": {"name": "My new item", "slug": "my-new-item"}, + } + expected_types: typing.Any = { + "id": None, + "cmsLocaleId": None, + "lastPublished": None, + "lastUpdated": None, + "createdOn": None, + "isArchived": None, + "isDraft": None, + "fieldData": {"name": None, "slug": None}, + } + response = client.collections.items.update_items( + collection_id="580e63fc8c9a982ac9b8b745", + items=[ + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5ea6", + cms_locale_id="66f6e966c9e1dc700a857ca5", + field_data=CollectionItemWithIdInputFieldData(name="Ne Paniquez Pas", slug="ne-paniquez-pas"), + ), + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5ea6", + cms_locale_id="66f6e966c9e1dc700a857ca4", + field_data=CollectionItemWithIdInputFieldData(name="No Entrar en Pánico", slug="no-entrar-en-panico"), + ), + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5eaa", + cms_locale_id="66f6e966c9e1dc700a857ca5", + field_data=CollectionItemWithIdInputFieldData( + name="Au Revoir et Merci pour Tous les Poissons", slug="au-revoir-et-merci" + ), + ), + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5eaa", + cms_locale_id="66f6e966c9e1dc700a857ca4", + field_data=CollectionItemWithIdInputFieldData( + name="Hasta Luego y Gracias por Todo el Pescado", slug="hasta-luego-y-gracias" + ), + ), + ], + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.collections.items.update_items( + collection_id="580e63fc8c9a982ac9b8b745", + items=[ + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5ea6", + cms_locale_id="66f6e966c9e1dc700a857ca5", + field_data=CollectionItemWithIdInputFieldData(name="Ne Paniquez Pas", slug="ne-paniquez-pas"), + ), + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5ea6", + cms_locale_id="66f6e966c9e1dc700a857ca4", + field_data=CollectionItemWithIdInputFieldData(name="No Entrar en Pánico", slug="no-entrar-en-panico"), + ), + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5eaa", + cms_locale_id="66f6e966c9e1dc700a857ca5", + field_data=CollectionItemWithIdInputFieldData( + name="Au Revoir et Merci pour Tous les Poissons", slug="au-revoir-et-merci" + ), + ), + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5eaa", + cms_locale_id="66f6e966c9e1dc700a857ca4", + field_data=CollectionItemWithIdInputFieldData( + name="Hasta Luego y Gracias por Todo el Pescado", slug="hasta-luego-y-gracias" + ), + ), + ], + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_list_items_live(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "items": [ + { + "id": "62b720ef280c7a7a3be8cabe", + "cmsLocaleId": "66f6e966c9e1dc700a857ca3", + "lastPublished": "2022-06-30T13:35:20.878Z", + "lastUpdated": "2022-06-25T14:51:27.809Z", + "createdOn": "2022-06-25T14:51:27.809Z", + "isArchived": False, + "isDraft": False, + "fieldData": {"name": "Senior Data Analyst", "slug": "senior-data-analyst"}, + }, + { + "id": "62c880ef281c7b7b4cf9dabc", + "cmsLocaleId": "66f6e966c9e1dc700a857ca3", + "lastPublished": "2023-04-15T10:25:18.123Z", + "lastUpdated": "2023-04-10T11:45:30.567Z", + "createdOn": "2023-04-10T11:45:30.567Z", + "isArchived": False, + "isDraft": False, + "fieldData": {"name": "Product Manager", "slug": "product-manager"}, + }, + ], + "pagination": {"limit": 25, "offset": 0, "total": 2}, + } + expected_types: typing.Any = { + "items": ( + "list", + { + 0: { + "id": None, + "cmsLocaleId": None, + "lastPublished": None, + "lastUpdated": None, + "createdOn": None, + "isArchived": None, + "isDraft": None, + "fieldData": {"name": None, "slug": None}, + }, + 1: { + "id": None, + "cmsLocaleId": None, + "lastPublished": None, + "lastUpdated": None, + "createdOn": None, + "isArchived": None, + "isDraft": None, + "fieldData": {"name": None, "slug": None}, + }, + }, + ), + "pagination": {"limit": None, "offset": None, "total": None}, + } + response = client.collections.items.list_items_live(collection_id="580e63fc8c9a982ac9b8b745") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.collections.items.list_items_live(collection_id="580e63fc8c9a982ac9b8b745") + validate_response(async_response, expected_response, expected_types) + + +async def test_create_item_live(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "id": "42b720ef280c7a7a3be8cabe", + "cmsLocaleId": "653ad57de882f528b32e810e", + "lastPublished": "2022-11-29T16:22:43.159Z", + "lastUpdated": "2022-11-17T17:19:43.282Z", + "createdOn": "2022-11-17T17:11:57.148Z", + "isArchived": False, + "isDraft": False, + "fieldData": {"name": "Pan Galactic Gargle Blaster Recipe", "slug": "pan-galactic-gargle-blaster"}, + } + expected_types: typing.Any = { + "id": None, + "cmsLocaleId": None, + "lastPublished": None, + "lastUpdated": None, + "createdOn": None, + "isArchived": None, + "isDraft": None, + "fieldData": {"name": None, "slug": None}, + } + response = client.collections.items.create_item_live( + collection_id="580e63fc8c9a982ac9b8b745", + request=CollectionItem( + is_archived=False, + is_draft=False, + field_data=CollectionItemFieldData( + name="Pan Galactic Gargle Blaster Recipe", slug="pan-galactic-gargle-blaster" + ), + ), + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.collections.items.create_item_live( + collection_id="580e63fc8c9a982ac9b8b745", + request=CollectionItem( + is_archived=False, + is_draft=False, + field_data=CollectionItemFieldData( + name="Pan Galactic Gargle Blaster Recipe", slug="pan-galactic-gargle-blaster" + ), + ), + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_delete_items_live(client: Webflow, async_client: AsyncWebflow) -> None: + # Type ignore to avoid mypy complaining about the function not being meant to return a value + assert client.collections.items.delete_items_live(collection_id="580e63fc8c9a982ac9b8b745") is None # type: ignore[func-returns-value] + + assert await async_client.collections.items.delete_items_live(collection_id="580e63fc8c9a982ac9b8b745") is None # type: ignore[func-returns-value] + + +async def test_update_items_live(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "items": [ + { + "id": "66f6ed9576ddacf3149d5ea6", + "cmsLocaleId": "66f6e966c9e1dc700a857ca5", + "lastPublished": "2023-03-17T18:47:35.560Z", + "lastUpdated": "2024-09-27T17:38:29.066Z", + "createdOn": "2024-09-27T17:38:29.066Z", + "isArchived": True, + "isDraft": True, + "fieldData": {"name": "Ne Paniquez Pas", "slug": "ne-paniquez-pas"}, + }, + { + "id": "66f6ed9576ddacf3149d5ea6", + "cmsLocaleId": "66f6e966c9e1dc700a857ca4", + "lastPublished": "2023-03-17T18:47:35.560Z", + "lastUpdated": "2024-09-27T17:38:29.066Z", + "createdOn": "2024-09-27T17:38:29.066Z", + "isArchived": True, + "isDraft": True, + "fieldData": {"name": "No Entrar en Pánico", "slug": "no-entrar-en-panico"}, + }, + { + "id": "66f6ed9576ddacf3149d5eaa", + "cmsLocaleId": "66f6e966c9e1dc700a857ca5", + "lastPublished": "2023-03-17T18:47:35.560Z", + "lastUpdated": "2024-09-27T17:38:29.066Z", + "createdOn": "2024-09-27T17:38:29.066Z", + "isArchived": True, + "isDraft": True, + "fieldData": {"name": "Au Revoir et Merci pour Tous les Poissons", "slug": "au-revoir-et-merci"}, + }, + { + "id": "66f6ed9576ddacf3149d5eaa", + "cmsLocaleId": "66f6e966c9e1dc700a857ca4", + "lastPublished": "2023-03-17T18:47:35.560Z", + "lastUpdated": "2024-09-27T17:38:29.066Z", + "createdOn": "2024-09-27T17:38:29.066Z", + "isArchived": True, + "isDraft": True, + "fieldData": {"name": "Hasta Luego y Gracias por Todo el Pescado", "slug": "hasta-luego-y-gracias"}, + }, + ] + } + expected_types: typing.Any = { + "items": ( + "list", + { + 0: { + "id": None, + "cmsLocaleId": None, + "lastPublished": None, + "lastUpdated": None, + "createdOn": None, + "isArchived": None, + "isDraft": None, + "fieldData": {"name": None, "slug": None}, + }, + 1: { + "id": None, + "cmsLocaleId": None, + "lastPublished": None, + "lastUpdated": None, + "createdOn": None, + "isArchived": None, + "isDraft": None, + "fieldData": {"name": None, "slug": None}, + }, + 2: { + "id": None, + "cmsLocaleId": None, + "lastPublished": None, + "lastUpdated": None, + "createdOn": None, + "isArchived": None, + "isDraft": None, + "fieldData": {"name": None, "slug": None}, + }, + 3: { + "id": None, + "cmsLocaleId": None, + "lastPublished": None, + "lastUpdated": None, + "createdOn": None, + "isArchived": None, + "isDraft": None, + "fieldData": {"name": None, "slug": None}, + }, + }, + ) + } + response = client.collections.items.update_items_live( + collection_id="580e63fc8c9a982ac9b8b745", + items=[ + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5ea6", + cms_locale_id="66f6e966c9e1dc700a857ca5", + field_data=CollectionItemWithIdInputFieldData(name="Ne Paniquez Pas", slug="ne-paniquez-pas"), + ), + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5ea6", + cms_locale_id="66f6e966c9e1dc700a857ca4", + field_data=CollectionItemWithIdInputFieldData(name="No Entrar en Pánico", slug="no-entrar-en-panico"), + ), + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5eaa", + cms_locale_id="66f6e966c9e1dc700a857ca5", + field_data=CollectionItemWithIdInputFieldData( + name="Au Revoir et Merci pour Tous les Poissons", slug="au-revoir-et-merci" + ), + ), + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5eaa", + cms_locale_id="66f6e966c9e1dc700a857ca4", + field_data=CollectionItemWithIdInputFieldData( + name="Hasta Luego y Gracias por Todo el Pescado", slug="hasta-luego-y-gracias" + ), + ), + ], + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.collections.items.update_items_live( + collection_id="580e63fc8c9a982ac9b8b745", + items=[ + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5ea6", + cms_locale_id="66f6e966c9e1dc700a857ca5", + field_data=CollectionItemWithIdInputFieldData(name="Ne Paniquez Pas", slug="ne-paniquez-pas"), + ), + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5ea6", + cms_locale_id="66f6e966c9e1dc700a857ca4", + field_data=CollectionItemWithIdInputFieldData(name="No Entrar en Pánico", slug="no-entrar-en-panico"), + ), + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5eaa", + cms_locale_id="66f6e966c9e1dc700a857ca5", + field_data=CollectionItemWithIdInputFieldData( + name="Au Revoir et Merci pour Tous les Poissons", slug="au-revoir-et-merci" + ), + ), + CollectionItemWithIdInput( + id="66f6ed9576ddacf3149d5eaa", + cms_locale_id="66f6e966c9e1dc700a857ca4", + field_data=CollectionItemWithIdInputFieldData( + name="Hasta Luego y Gracias por Todo el Pescado", slug="hasta-luego-y-gracias" + ), + ), + ], + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_create_items(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "id": "580e64008c9a982ac9b8b754", + "cmsLocaleIds": ["653ad57de882f528b32e810e", "6514390aea353fc691d69827", "65143930ea353fc691d69cd8"], + "lastPublished": "2023-03-17T18:47:35.560Z", + "lastUpdated": "2023-03-17T18:47:35.560Z", + "createdOn": "2023-03-17T18:47:35.560Z", + "isArchived": True, + "isDraft": True, + "fieldData": {"name": "My new item", "slug": "my-new-item"}, + } + expected_types: typing.Any = { + "id": None, + "cmsLocaleIds": ("list", {0: None, 1: None, 2: None}), + "lastPublished": None, + "lastUpdated": None, + "createdOn": None, + "isArchived": None, + "isDraft": None, + "fieldData": {"name": None, "slug": None}, + } + response = client.collections.items.create_items( + collection_id="580e63fc8c9a982ac9b8b745", + cms_locale_ids=["66f6e966c9e1dc700a857ca3", "66f6e966c9e1dc700a857ca4", "66f6e966c9e1dc700a857ca5"], + is_archived=False, + is_draft=False, + field_data=SingleCmsItem(name="Don’t Panic", slug="dont-panic"), + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.collections.items.create_items( + collection_id="580e63fc8c9a982ac9b8b745", + cms_locale_ids=["66f6e966c9e1dc700a857ca3", "66f6e966c9e1dc700a857ca4", "66f6e966c9e1dc700a857ca5"], + is_archived=False, + is_draft=False, + field_data=SingleCmsItem(name="Don’t Panic", slug="dont-panic"), + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_get_item(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "id": "42b720ef280c7a7a3be8cabe", + "cmsLocaleId": "653ad57de882f528b32e810e", + "lastPublished": "2022-11-29T16:22:43.159Z", + "lastUpdated": "2022-11-17T17:19:43.282Z", + "createdOn": "2022-11-17T17:11:57.148Z", + "isArchived": False, + "isDraft": False, + "fieldData": {"name": "Pan Galactic Gargle Blaster Recipe", "slug": "pan-galactic-gargle-blaster"}, + } + expected_types: typing.Any = { + "id": None, + "cmsLocaleId": None, + "lastPublished": None, + "lastUpdated": None, + "createdOn": None, + "isArchived": None, + "isDraft": None, + "fieldData": {"name": None, "slug": None}, + } + response = client.collections.items.get_item( + collection_id="580e63fc8c9a982ac9b8b745", item_id="580e64008c9a982ac9b8b754" + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.collections.items.get_item( + collection_id="580e63fc8c9a982ac9b8b745", item_id="580e64008c9a982ac9b8b754" + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_delete_item(client: Webflow, async_client: AsyncWebflow) -> None: + # Type ignore to avoid mypy complaining about the function not being meant to return a value + assert client.collections.items.delete_item(collection_id="580e63fc8c9a982ac9b8b745", item_id="580e64008c9a982ac9b8b754") is None # type: ignore[func-returns-value] + + assert await async_client.collections.items.delete_item(collection_id="580e63fc8c9a982ac9b8b745", item_id="580e64008c9a982ac9b8b754") is None # type: ignore[func-returns-value] + + +async def test_update_item(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "id": "42b720ef280c7a7a3be8cabe", + "cmsLocaleId": "653ad57de882f528b32e810e", + "lastPublished": "2022-11-29T16:22:43.159Z", + "lastUpdated": "2022-11-17T17:19:43.282Z", + "createdOn": "2022-11-17T17:11:57.148Z", + "isArchived": False, + "isDraft": False, + "fieldData": {"name": "Pan Galactic Gargle Blaster Recipe", "slug": "pan-galactic-gargle-blaster"}, + } + expected_types: typing.Any = { + "id": None, + "cmsLocaleId": None, + "lastPublished": None, + "lastUpdated": None, + "createdOn": None, + "isArchived": None, + "isDraft": None, + "fieldData": {"name": None, "slug": None}, + } + response = client.collections.items.update_item( + collection_id="580e63fc8c9a982ac9b8b745", + item_id="580e64008c9a982ac9b8b754", + is_archived=False, + is_draft=False, + field_data=CollectionItemPatchSingleFieldData( + name="Pan Galactic Gargle Blaster Recipe", slug="pan-galactic-gargle-blaster" + ), + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.collections.items.update_item( + collection_id="580e63fc8c9a982ac9b8b745", + item_id="580e64008c9a982ac9b8b754", + is_archived=False, + is_draft=False, + field_data=CollectionItemPatchSingleFieldData( + name="Pan Galactic Gargle Blaster Recipe", slug="pan-galactic-gargle-blaster" + ), + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_get_item_live(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "id": "42b720ef280c7a7a3be8cabe", + "cmsLocaleId": "653ad57de882f528b32e810e", + "lastPublished": "2022-11-29T16:22:43.159Z", + "lastUpdated": "2022-11-17T17:19:43.282Z", + "createdOn": "2022-11-17T17:11:57.148Z", + "isArchived": False, + "isDraft": False, + "fieldData": {"name": "Pan Galactic Gargle Blaster Recipe", "slug": "pan-galactic-gargle-blaster"}, + } + expected_types: typing.Any = { + "id": None, + "cmsLocaleId": None, + "lastPublished": None, + "lastUpdated": None, + "createdOn": None, + "isArchived": None, + "isDraft": None, + "fieldData": {"name": None, "slug": None}, + } + response = client.collections.items.get_item_live( + collection_id="580e63fc8c9a982ac9b8b745", item_id="580e64008c9a982ac9b8b754" + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.collections.items.get_item_live( + collection_id="580e63fc8c9a982ac9b8b745", item_id="580e64008c9a982ac9b8b754" + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_delete_item_live(client: Webflow, async_client: AsyncWebflow) -> None: + # Type ignore to avoid mypy complaining about the function not being meant to return a value + assert client.collections.items.delete_item_live(collection_id="580e63fc8c9a982ac9b8b745", item_id="580e64008c9a982ac9b8b754") is None # type: ignore[func-returns-value] + + assert await async_client.collections.items.delete_item_live(collection_id="580e63fc8c9a982ac9b8b745", item_id="580e64008c9a982ac9b8b754") is None # type: ignore[func-returns-value] + + +async def test_update_item_live(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "id": "42b720ef280c7a7a3be8cabe", + "cmsLocaleId": "653ad57de882f528b32e810e", + "lastPublished": "2022-11-29T16:22:43.159Z", + "lastUpdated": "2022-11-17T17:19:43.282Z", + "createdOn": "2022-11-17T17:11:57.148Z", + "isArchived": False, + "isDraft": False, + "fieldData": {"name": "Pan Galactic Gargle Blaster Recipe", "slug": "pan-galactic-gargle-blaster"}, + } + expected_types: typing.Any = { + "id": None, + "cmsLocaleId": None, + "lastPublished": None, + "lastUpdated": None, + "createdOn": None, + "isArchived": None, + "isDraft": None, + "fieldData": {"name": None, "slug": None}, + } + response = client.collections.items.update_item_live( + collection_id="580e63fc8c9a982ac9b8b745", + item_id="580e64008c9a982ac9b8b754", + is_archived=False, + is_draft=False, + field_data=CollectionItemPatchSingleFieldData( + name="Pan Galactic Gargle Blaster Recipe", slug="pan-galactic-gargle-blaster" + ), + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.collections.items.update_item_live( + collection_id="580e63fc8c9a982ac9b8b745", + item_id="580e64008c9a982ac9b8b754", + is_archived=False, + is_draft=False, + field_data=CollectionItemPatchSingleFieldData( + name="Pan Galactic Gargle Blaster Recipe", slug="pan-galactic-gargle-blaster" + ), + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_publish_item(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "publishedItemIds": ["643fd856d66b6528195ee2ca", "643fd856d66b6528195ee2cb"], + "errors": ["Staging item ID 643fd856d66b6528195ee2cf not found."], + } + expected_types: typing.Any = {"publishedItemIds": ("list", {0: None, 1: None}), "errors": ("list", {0: None})} + response = client.collections.items.publish_item(collection_id="580e63fc8c9a982ac9b8b745", item_ids=["itemIds"]) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.collections.items.publish_item( + collection_id="580e63fc8c9a982ac9b8b745", item_ids=["itemIds"] + ) + validate_response(async_response, expected_response, expected_types) diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..95cd9fa --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import os + +import pytest +from webflow.client import AsyncWebflow, Webflow + + +@pytest.fixture +def client() -> Webflow: + return Webflow( + access_token=os.getenv("ENV_ACCESS_TOKEN", "access_token"), base_url=os.getenv("TESTS_BASE_URL", "base_url") + ) + + +@pytest.fixture +def async_client() -> AsyncWebflow: + return AsyncWebflow( + access_token=os.getenv("ENV_ACCESS_TOKEN", "access_token"), base_url=os.getenv("TESTS_BASE_URL", "base_url") + ) diff --git a/tests/pages/__init__.py b/tests/pages/__init__.py new file mode 100644 index 0000000..f3ea265 --- /dev/null +++ b/tests/pages/__init__.py @@ -0,0 +1,2 @@ +# This file was auto-generated by Fern from our API Definition. + diff --git a/tests/pages/test_scripts.py b/tests/pages/test_scripts.py new file mode 100644 index 0000000..9e7492d --- /dev/null +++ b/tests/pages/test_scripts.py @@ -0,0 +1,90 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from webflow import ScriptApply, ScriptApplyLocation +from webflow.client import AsyncWebflow, Webflow + +from ..utilities import validate_response + + +async def test_get_custom_code(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "scripts": [{"id": "id", "location": "header", "version": "version", "attributes": {"key": "value"}}], + "lastUpdated": "lastUpdated", + "createdOn": "createdOn", + } + expected_types: typing.Any = { + "scripts": ( + "list", + {0: {"id": None, "location": None, "version": None, "attributes": ("dict", {0: (None, None)})}}, + ), + "lastUpdated": None, + "createdOn": None, + } + response = client.pages.scripts.get_custom_code(page_id="63c720f9347c2139b248e552") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.pages.scripts.get_custom_code(page_id="63c720f9347c2139b248e552") + validate_response(async_response, expected_response, expected_types) + + +async def test_upsert_custom_code(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "scripts": [ + { + "id": "cms_slider", + "location": "header", + "version": "1.0.0", + "attributes": {"my-attribute": "some-value"}, + }, + {"id": "alert", "location": "header", "version": "0.0.1", "attributes": {"key": "value"}}, + ], + "lastUpdated": "2022-10-26T00:28:54.191Z", + "createdOn": "2022-10-26T00:28:54.191Z", + } + expected_types: typing.Any = { + "scripts": ( + "list", + { + 0: {"id": None, "location": None, "version": None, "attributes": ("dict", {0: (None, None)})}, + 1: {"id": None, "location": None, "version": None, "attributes": ("dict", {0: (None, None)})}, + }, + ), + "lastUpdated": None, + "createdOn": None, + } + response = client.pages.scripts.upsert_custom_code( + page_id="63c720f9347c2139b248e552", + scripts=[ + ScriptApply( + id="cms_slider", + location=ScriptApplyLocation.HEADER, + version="1.0.0", + attributes={"my-attribute": "some-value"}, + ), + ScriptApply(id="alert", location=ScriptApplyLocation.HEADER, version="0.0.1"), + ], + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.pages.scripts.upsert_custom_code( + page_id="63c720f9347c2139b248e552", + scripts=[ + ScriptApply( + id="cms_slider", + location=ScriptApplyLocation.HEADER, + version="1.0.0", + attributes={"my-attribute": "some-value"}, + ), + ScriptApply(id="alert", location=ScriptApplyLocation.HEADER, version="0.0.1"), + ], + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_delete_custom_code(client: Webflow, async_client: AsyncWebflow) -> None: + # Type ignore to avoid mypy complaining about the function not being meant to return a value + assert client.pages.scripts.delete_custom_code(page_id="63c720f9347c2139b248e552") is None # type: ignore[func-returns-value] + + assert await async_client.pages.scripts.delete_custom_code(page_id="63c720f9347c2139b248e552") is None # type: ignore[func-returns-value] diff --git a/tests/sites/__init__.py b/tests/sites/__init__.py new file mode 100644 index 0000000..f3ea265 --- /dev/null +++ b/tests/sites/__init__.py @@ -0,0 +1,2 @@ +# This file was auto-generated by Fern from our API Definition. + diff --git a/tests/sites/test_activity_logs.py b/tests/sites/test_activity_logs.py new file mode 100644 index 0000000..4f1c47d --- /dev/null +++ b/tests/sites/test_activity_logs.py @@ -0,0 +1,54 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from webflow.client import AsyncWebflow, Webflow + +from ..utilities import validate_response + + +async def test_list_(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "items": [ + { + "id": "654c16c7b229e56bcf26872d", + "createdOn": "2023-11-08T23:16:23Z", + "lastUpdated": "2023-11-08T23:16:23Z", + "event": "cms_collection", + "resourceOperation": "CREATED", + "user": {"id": "6509cd56e90eec668b009712", "displayName": "John Doe"}, + "resourceId": "654c16c7b229e56bcf26870c", + "resourceName": "foo-bar", + "newValue": "newValue", + "previousValue": "previousValue", + "payload": {"key": "value"}, + } + ], + "pagination": {"limit": 25, "offset": 0, "total": 1}, + } + expected_types: typing.Any = { + "items": ( + "list", + { + 0: { + "id": None, + "createdOn": "datetime", + "lastUpdated": "datetime", + "event": None, + "resourceOperation": None, + "user": {"id": None, "displayName": None}, + "resourceId": None, + "resourceName": None, + "newValue": None, + "previousValue": None, + "payload": ("dict", {0: (None, None)}), + } + }, + ), + "pagination": {"limit": None, "offset": None, "total": None}, + } + response = client.sites.activity_logs.list(site_id="580e63e98c9a982ac9b8b741") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.sites.activity_logs.list(site_id="580e63e98c9a982ac9b8b741") + validate_response(async_response, expected_response, expected_types) diff --git a/tests/sites/test_scripts.py b/tests/sites/test_scripts.py new file mode 100644 index 0000000..041e7f8 --- /dev/null +++ b/tests/sites/test_scripts.py @@ -0,0 +1,159 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from webflow import ScriptApply, ScriptApplyLocation +from webflow.client import AsyncWebflow, Webflow + +from ..utilities import validate_response + + +async def test_get_custom_code(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "scripts": [ + { + "id": "cms_slider", + "location": "header", + "version": "1.0.0", + "attributes": {"my-attribute": "some-value"}, + }, + {"id": "alert", "location": "header", "version": "0.0.1", "attributes": {"key": "value"}}, + ], + "lastUpdated": "2022-10-26T00:28:54.191Z", + "createdOn": "2022-10-26T00:28:54.191Z", + } + expected_types: typing.Any = { + "scripts": ( + "list", + { + 0: {"id": None, "location": None, "version": None, "attributes": ("dict", {0: (None, None)})}, + 1: {"id": None, "location": None, "version": None, "attributes": ("dict", {0: (None, None)})}, + }, + ), + "lastUpdated": None, + "createdOn": None, + } + response = client.sites.scripts.get_custom_code(site_id="580e63e98c9a982ac9b8b741") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.sites.scripts.get_custom_code(site_id="580e63e98c9a982ac9b8b741") + validate_response(async_response, expected_response, expected_types) + + +async def test_upsert_custom_code(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "scripts": [ + { + "id": "cms_slider", + "location": "header", + "version": "1.0.0", + "attributes": {"my-attribute": "some-value"}, + }, + {"id": "alert", "location": "header", "version": "0.0.1", "attributes": {"key": "value"}}, + ], + "lastUpdated": "lastUpdated", + "createdOn": "createdOn", + } + expected_types: typing.Any = { + "scripts": ( + "list", + { + 0: {"id": None, "location": None, "version": None, "attributes": ("dict", {0: (None, None)})}, + 1: {"id": None, "location": None, "version": None, "attributes": ("dict", {0: (None, None)})}, + }, + ), + "lastUpdated": None, + "createdOn": None, + } + response = client.sites.scripts.upsert_custom_code( + site_id="580e63e98c9a982ac9b8b741", + scripts=[ + ScriptApply( + id="cms_slider", + location=ScriptApplyLocation.HEADER, + version="1.0.0", + attributes={"my-attribute": "some-value"}, + ), + ScriptApply(id="alert", location=ScriptApplyLocation.HEADER, version="0.0.1"), + ], + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.sites.scripts.upsert_custom_code( + site_id="580e63e98c9a982ac9b8b741", + scripts=[ + ScriptApply( + id="cms_slider", + location=ScriptApplyLocation.HEADER, + version="1.0.0", + attributes={"my-attribute": "some-value"}, + ), + ScriptApply(id="alert", location=ScriptApplyLocation.HEADER, version="0.0.1"), + ], + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_delete_custom_code(client: Webflow, async_client: AsyncWebflow) -> None: + # Type ignore to avoid mypy complaining about the function not being meant to return a value + assert client.sites.scripts.delete_custom_code(site_id="580e63e98c9a982ac9b8b741") is None # type: ignore[func-returns-value] + + assert await async_client.sites.scripts.delete_custom_code(site_id="580e63e98c9a982ac9b8b741") is None # type: ignore[func-returns-value] + + +async def test_list_custom_code_blocks(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "blocks": [ + { + "siteId": "6258612d1ee792848f805dcf", + "pageId": "pageId", + "type": "site", + "scripts": [ + {"id": "chartjs", "location": "header", "version": "4.4.2", "attributes": {"key": "value"}} + ], + "createdOn": "2024-04-03T16:49:15Z", + "lastUpdated": "2024-04-03T16:49:15Z", + }, + { + "siteId": "6390c49674a71f84b51a08d8", + "pageId": "6419db964a9c43f6a3af6348", + "type": "page", + "scripts": [{"id": "id", "location": "header", "version": "version"}], + "createdOn": "2022-10-26T00:28:54Z", + "lastUpdated": "2022-10-26T00:28:54Z", + }, + ], + "pagination": {"limit": 10, "offset": 0, "total": 1}, + } + expected_types: typing.Any = { + "blocks": ( + "list", + { + 0: { + "siteId": None, + "pageId": None, + "type": None, + "scripts": ( + "list", + {0: {"id": None, "location": None, "version": None, "attributes": ("dict", {0: (None, None)})}}, + ), + "createdOn": "datetime", + "lastUpdated": "datetime", + }, + 1: { + "siteId": None, + "pageId": None, + "type": None, + "scripts": ("list", {0: {"id": None, "location": None, "version": None}}), + "createdOn": "datetime", + "lastUpdated": "datetime", + }, + }, + ), + "pagination": {"limit": None, "offset": None, "total": None}, + } + response = client.sites.scripts.list_custom_code_blocks(site_id="580e63e98c9a982ac9b8b741") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.sites.scripts.list_custom_code_blocks(site_id="580e63e98c9a982ac9b8b741") + validate_response(async_response, expected_response, expected_types) diff --git a/tests/test_access_groups.py b/tests/test_access_groups.py new file mode 100644 index 0000000..ec38534 --- /dev/null +++ b/tests/test_access_groups.py @@ -0,0 +1,50 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from webflow.client import AsyncWebflow, Webflow + +from .utilities import validate_response + + +async def test_list_(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "count": 1, + "limit": 10, + "offset": 0, + "total": 1, + "accessGroups": [ + { + "id": "62be58d404be8a6cc900c081", + "name": "Research Team", + "shortId": "rt", + "slug": "hitchhikers-guide-research-team", + "createdOn": "2022-08-01T19:41:48Z", + }, + { + "id": "65a96161991e77bbb4a6c573", + "name": "Admin", + "shortId": "ad", + "slug": "admin", + "createdOn": "2022-08-01T19:41:48Z", + }, + ], + } + expected_types: typing.Any = { + "count": None, + "limit": None, + "offset": None, + "total": None, + "accessGroups": ( + "list", + { + 0: {"id": None, "name": None, "shortId": None, "slug": None, "createdOn": "datetime"}, + 1: {"id": None, "name": None, "shortId": None, "slug": None, "createdOn": "datetime"}, + }, + ), + } + response = client.access_groups.list(site_id="580e63e98c9a982ac9b8b741") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.access_groups.list(site_id="580e63e98c9a982ac9b8b741") + validate_response(async_response, expected_response, expected_types) diff --git a/tests/test_assets.py b/tests/test_assets.py new file mode 100644 index 0000000..9ebae32 --- /dev/null +++ b/tests/test_assets.py @@ -0,0 +1,353 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from webflow.client import AsyncWebflow, Webflow + +from .utilities import validate_response + + +async def test_list_(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "assets": [ + { + "id": "63e5889e7fe4eafa7384cea4", + "contentType": "image/png", + "size": 2212772, + "siteId": "63938b302ea6b0aa6f3d8745", + "hostedUrl": "https://s3.amazonaws.com/webflow-prod-assets/63938b302ea6b0aa6f3d8745/63e5889e7fe4eafa7384cea4_Vectors-Wrapper.svg", + "originalFileName": "Candy-Wrapper.svg", + "displayName": "63e5889e7fe4eafa7384cea4_Candy-Wrapper.png", + "lastUpdated": "2023-03-01T23:42:57Z", + "createdOn": "2023-02-09T23:58:22Z", + "variants": [ + { + "hostedUrl": "https://s3.amazonaws.com/webflow-prod-assets/6258612d1ee792848f805dcf/660d83ce30f3a599ddb0bdb3_Screenshot%202024-03-20%20at%209.03.24%E2%80%AFPM-p-500.png", + "originalFileName": "Screenshot%202024-03-20%20at%209.03.24%E2%80%AFPM-p-500.png", + "displayName": "660d83ce30f3a599ddb0bdb3_Screenshot%202024-03-20%20at%209.03.24%E2%80%AFPM-p-500.png", + "format": "png", + "width": 500, + "height": 900, + "quality": 100, + } + ], + "altText": "A red chair", + } + ] + } + expected_types: typing.Any = { + "assets": ( + "list", + { + 0: { + "id": None, + "contentType": None, + "size": "integer", + "siteId": None, + "hostedUrl": None, + "originalFileName": None, + "displayName": None, + "lastUpdated": "datetime", + "createdOn": "datetime", + "variants": ( + "list", + { + 0: { + "hostedUrl": None, + "originalFileName": None, + "displayName": None, + "format": None, + "width": "integer", + "height": "integer", + "quality": "integer", + } + }, + ), + "altText": None, + } + }, + ) + } + response = client.assets.list(site_id="580e63e98c9a982ac9b8b741") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.assets.list(site_id="580e63e98c9a982ac9b8b741") + validate_response(async_response, expected_response, expected_types) + + +async def test_create(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "uploadDetails": { + "acl": "public-read", + "bucket": "webflow-bucket-name", + "X-Amz-Algorithm": "AWS4-HMAC-SHA256", + "X-Amz-Credential": "///s3/aws4_request", + "X-Amz-Date": "", + "key": "/_", + "Policy": "", + "X-Amz-Signature": "", + "success_action_status": "201", + "content-type": "image/png", + "Cache-Control": "max-age=31536000, must-revalidate", + }, + "contentType": "image/png", + "id": "64358b9544249dc43d37d2b7", + "parentFolder": "6436b1ce5281cace05b65aea", + "uploadUrl": "https://s3.amazonaws.com/webflow-dev-assets/643021114e290e0d3a0602b2/64358b9544249dc43d37d2b7_Screenshot%202023-04-11%20at%209.50.42%20AM.png", + "assetUrl": "https://s3.amazonaws.com/webflow-prod-assets/6258612d1ee792848f805dcf/660d907ab9e91e3e9f56385e_paranoidAndroid-2024.png", + "hostedUrl": "https://d1otoma47x30pg.cloudfront.net/643021114e290e0d3a0602b2/64358b9544249dc43d37d2b7_Screenshot%202023-04-11%20at%209.50.42%20AM.png", + "originalFileName": "file.png", + "createdOn": "2023-04-11T16:32:21Z", + "lastUpdated": "2023-04-12T20:31:03Z", + } + expected_types: typing.Any = { + "uploadDetails": { + "acl": None, + "bucket": None, + "X-Amz-Algorithm": None, + "X-Amz-Credential": None, + "X-Amz-Date": None, + "key": None, + "Policy": None, + "X-Amz-Signature": None, + "success_action_status": None, + "content-type": None, + "Cache-Control": None, + }, + "contentType": None, + "id": None, + "parentFolder": None, + "uploadUrl": None, + "assetUrl": None, + "hostedUrl": None, + "originalFileName": None, + "createdOn": "datetime", + "lastUpdated": "datetime", + } + response = client.assets.create( + site_id="580e63e98c9a982ac9b8b741", file_name="file.png", file_hash="3c7d87c9575702bc3b1e991f4d3c638e" + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.assets.create( + site_id="580e63e98c9a982ac9b8b741", file_name="file.png", file_hash="3c7d87c9575702bc3b1e991f4d3c638e" + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_get(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "id": "55131cd036c09f7d07883dfc", + "contentType": "image/png", + "size": 1500, + "siteId": "62749158efef318abc8d5a0f", + "hostedUrl": "example.com/hostedimage.png", + "originalFileName": "image.png", + "displayName": "example-image-123.png", + "lastUpdated": "2016-09-06T21:12:22Z", + "createdOn": "2016-09-02T23:26:22Z", + "variants": [ + { + "hostedUrl": "example.com/hostedimage.png", + "originalFileName": "image.png", + "displayName": "A brown dog", + "format": "format", + "width": 1500, + "height": 900, + "quality": 1, + "error": "error", + } + ], + "altText": "A red chair", + } + expected_types: typing.Any = { + "id": None, + "contentType": None, + "size": "integer", + "siteId": None, + "hostedUrl": None, + "originalFileName": None, + "displayName": None, + "lastUpdated": "datetime", + "createdOn": "datetime", + "variants": ( + "list", + { + 0: { + "hostedUrl": None, + "originalFileName": None, + "displayName": None, + "format": None, + "width": "integer", + "height": "integer", + "quality": "integer", + "error": None, + } + }, + ), + "altText": None, + } + response = client.assets.get(asset_id="580e63fc8c9a982ac9b8b745") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.assets.get(asset_id="580e63fc8c9a982ac9b8b745") + validate_response(async_response, expected_response, expected_types) + + +async def test_delete(client: Webflow, async_client: AsyncWebflow) -> None: + # Type ignore to avoid mypy complaining about the function not being meant to return a value + assert client.assets.delete(asset_id="580e63fc8c9a982ac9b8b745") is None # type: ignore[func-returns-value] + + assert await async_client.assets.delete(asset_id="580e63fc8c9a982ac9b8b745") is None # type: ignore[func-returns-value] + + +async def test_update(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "id": "55131cd036c09f7d07883dfc", + "contentType": "image/png", + "size": 1500, + "siteId": "62749158efef318abc8d5a0f", + "hostedUrl": "example.com/hostedimage.png", + "originalFileName": "image.png", + "displayName": "example-image-123.png", + "lastUpdated": "2016-09-06T21:12:22Z", + "createdOn": "2016-09-02T23:26:22Z", + "variants": [ + { + "hostedUrl": "example.com/hostedimage.png", + "originalFileName": "image.png", + "displayName": "A brown dog", + "format": "format", + "width": 1500, + "height": 900, + "quality": 1, + "error": "error", + } + ], + "altText": "A red chair", + } + expected_types: typing.Any = { + "id": None, + "contentType": None, + "size": "integer", + "siteId": None, + "hostedUrl": None, + "originalFileName": None, + "displayName": None, + "lastUpdated": "datetime", + "createdOn": "datetime", + "variants": ( + "list", + { + 0: { + "hostedUrl": None, + "originalFileName": None, + "displayName": None, + "format": None, + "width": "integer", + "height": "integer", + "quality": "integer", + "error": None, + } + }, + ), + "altText": None, + } + response = client.assets.update(asset_id="580e63fc8c9a982ac9b8b745") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.assets.update(asset_id="580e63fc8c9a982ac9b8b745") + validate_response(async_response, expected_response, expected_types) + + +async def test_list_folders(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "assetFolders": [ + { + "id": "6390c49774a71f0e3c1a08ee", + "displayName": "emoji icons", + "parentFolder": "6390c49774a71f99f21a08eb", + "assets": ["63e5889e7fe4eafa7384cea4", "659595234426a9fcbad57043"], + "siteId": "6390c49674a71f84b51a08d8", + "createdOn": "2018-10-14T21:55:49Z", + "lastUpdated": "2022-12-07T16:51:37Z", + } + ], + "pagination": {"limit": 1, "offset": 0, "total": 1}, + } + expected_types: typing.Any = { + "assetFolders": ( + "list", + { + 0: { + "id": None, + "displayName": None, + "parentFolder": None, + "assets": ("list", {0: None, 1: None}), + "siteId": None, + "createdOn": "datetime", + "lastUpdated": "datetime", + } + }, + ), + "pagination": {"limit": None, "offset": None, "total": None}, + } + response = client.assets.list_folders(site_id="580e63e98c9a982ac9b8b741") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.assets.list_folders(site_id="580e63e98c9a982ac9b8b741") + validate_response(async_response, expected_response, expected_types) + + +async def test_create_folder(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "id": "6390c49774a71f0e3c1a08ee", + "displayName": "emoji icons", + "parentFolder": "6390c49774a71f99f21a08eb", + "assets": ["63e5889e7fe4eafa7384cea4", "659595234426a9fcbad57043"], + "siteId": "6390c49674a71f84b51a08d8", + "createdOn": "2018-10-14T21:55:49Z", + "lastUpdated": "2022-12-07T16:51:37Z", + } + expected_types: typing.Any = { + "id": None, + "displayName": None, + "parentFolder": None, + "assets": ("list", {0: None, 1: None}), + "siteId": None, + "createdOn": "datetime", + "lastUpdated": "datetime", + } + response = client.assets.create_folder(site_id="580e63e98c9a982ac9b8b741", display_name="my asset folder") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.assets.create_folder( + site_id="580e63e98c9a982ac9b8b741", display_name="my asset folder" + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_get_folder(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "id": "6390c49774a71f0e3c1a08ee", + "displayName": "emoji icons", + "parentFolder": "6390c49774a71f99f21a08eb", + "assets": ["63e5889e7fe4eafa7384cea4", "659595234426a9fcbad57043"], + "siteId": "6390c49674a71f84b51a08d8", + "createdOn": "2018-10-14T21:55:49Z", + "lastUpdated": "2022-12-07T16:51:37Z", + } + expected_types: typing.Any = { + "id": None, + "displayName": None, + "parentFolder": None, + "assets": ("list", {0: None, 1: None}), + "siteId": None, + "createdOn": "datetime", + "lastUpdated": "datetime", + } + response = client.assets.get_folder(asset_folder_id="6390c49774a71f0e3c1a08ee") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.assets.get_folder(asset_folder_id="6390c49774a71f0e3c1a08ee") + validate_response(async_response, expected_response, expected_types) diff --git a/tests/test_collections.py b/tests/test_collections.py new file mode 100644 index 0000000..dc4df53 --- /dev/null +++ b/tests/test_collections.py @@ -0,0 +1,183 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from webflow.client import AsyncWebflow, Webflow + +from .utilities import validate_response + + +async def test_list_(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "collections": [ + { + "id": "63692ab61fb2852f582ba8f5", + "displayName": "Products", + "singularName": "Product", + "slug": "product", + "createdOn": "2019-06-12T13:35:14Z", + "lastUpdated": "2022-11-17T15:08:50Z", + }, + { + "id": "63692ab61fb2856e6a2ba8f6", + "displayName": "Categories", + "singularName": "Category", + "slug": "category", + "createdOn": "2019-06-12T13:35:14Z", + "lastUpdated": "2022-11-17T15:08:50Z", + }, + { + "id": "63692ab61fb285a8562ba8f4", + "displayName": "SKUs", + "singularName": "SKU", + "slug": "sku", + "createdOn": "2019-06-12T13:35:14Z", + "lastUpdated": "2022-11-17T15:08:50Z", + }, + ] + } + expected_types: typing.Any = { + "collections": ( + "list", + { + 0: { + "id": None, + "displayName": None, + "singularName": None, + "slug": None, + "createdOn": "datetime", + "lastUpdated": "datetime", + }, + 1: { + "id": None, + "displayName": None, + "singularName": None, + "slug": None, + "createdOn": "datetime", + "lastUpdated": "datetime", + }, + 2: { + "id": None, + "displayName": None, + "singularName": None, + "slug": None, + "createdOn": "datetime", + "lastUpdated": "datetime", + }, + }, + ) + } + response = client.collections.list(site_id="580e63e98c9a982ac9b8b741") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.collections.list(site_id="580e63e98c9a982ac9b8b741") + validate_response(async_response, expected_response, expected_types) + + +async def test_create(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "id": "580e63fc8c9a982ac9b8b745", + "displayName": "Blog Posts", + "singularName": "Blog Post", + "slug": "post", + "createdOn": "2016-10-24T19:41:48Z", + "lastUpdated": "2016-10-24T19:42:38Z", + "fields": [ + { + "id": "23cc2d952d4e4631ffd4345d2743db4e", + "isRequired": True, + "isEditable": True, + "type": "PlainText", + "slug": "name", + "displayName": "Name", + "helpText": "helpText", + } + ], + } + expected_types: typing.Any = { + "id": None, + "displayName": None, + "singularName": None, + "slug": None, + "createdOn": "datetime", + "lastUpdated": "datetime", + "fields": ( + "list", + { + 0: { + "id": None, + "isRequired": None, + "isEditable": None, + "type": None, + "slug": None, + "displayName": None, + "helpText": None, + } + }, + ), + } + response = client.collections.create( + site_id="580e63e98c9a982ac9b8b741", display_name="Blog Posts", singular_name="Blog Post", slug="posts" + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.collections.create( + site_id="580e63e98c9a982ac9b8b741", display_name="Blog Posts", singular_name="Blog Post", slug="posts" + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_get(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "id": "580e63fc8c9a982ac9b8b745", + "displayName": "Blog Posts", + "singularName": "Blog Post", + "slug": "post", + "createdOn": "2016-10-24T19:41:48Z", + "lastUpdated": "2016-10-24T19:42:38Z", + "fields": [ + { + "id": "23cc2d952d4e4631ffd4345d2743db4e", + "isRequired": True, + "isEditable": True, + "type": "PlainText", + "slug": "name", + "displayName": "Name", + "helpText": "helpText", + } + ], + } + expected_types: typing.Any = { + "id": None, + "displayName": None, + "singularName": None, + "slug": None, + "createdOn": "datetime", + "lastUpdated": "datetime", + "fields": ( + "list", + { + 0: { + "id": None, + "isRequired": None, + "isEditable": None, + "type": None, + "slug": None, + "displayName": None, + "helpText": None, + } + }, + ), + } + response = client.collections.get(collection_id="580e63fc8c9a982ac9b8b745") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.collections.get(collection_id="580e63fc8c9a982ac9b8b745") + validate_response(async_response, expected_response, expected_types) + + +async def test_delete(client: Webflow, async_client: AsyncWebflow) -> None: + # Type ignore to avoid mypy complaining about the function not being meant to return a value + assert client.collections.delete(collection_id="580e63fc8c9a982ac9b8b745") is None # type: ignore[func-returns-value] + + assert await async_client.collections.delete(collection_id="580e63fc8c9a982ac9b8b745") is None # type: ignore[func-returns-value] diff --git a/tests/test_ecommerce.py b/tests/test_ecommerce.py new file mode 100644 index 0000000..a7e7fc4 --- /dev/null +++ b/tests/test_ecommerce.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from webflow.client import AsyncWebflow, Webflow + +from .utilities import validate_response + + +async def test_get_settings(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "siteId": "5eb0b5583bf24e2d3a488969", + "createdOn": "2018-10-04T15:21:02Z", + "defaultCurrency": "USD", + } + expected_types: typing.Any = {"siteId": None, "createdOn": "datetime", "defaultCurrency": None} + response = client.ecommerce.get_settings(site_id="580e63e98c9a982ac9b8b741") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.ecommerce.get_settings(site_id="580e63e98c9a982ac9b8b741") + validate_response(async_response, expected_response, expected_types) diff --git a/tests/test_forms.py b/tests/test_forms.py new file mode 100644 index 0000000..50d7739 --- /dev/null +++ b/tests/test_forms.py @@ -0,0 +1,267 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from webflow.client import AsyncWebflow, Webflow + +from .utilities import validate_response + + +async def test_list_(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "forms": [ + { + "displayName": "Email Form", + "createdOn": "2016-10-24T19:41:29Z", + "lastUpdated": "2016-10-24T19:43:17Z", + "fields": { + "0": {"displayName": "Email", "userVisible": True}, + "1": {"displayName": "Email", "userVisible": True}, + }, + "responseSettings": { + "redirectUrl": "https://example.com", + "redirectMethod": "GET", + "sendEmailConfirmation": True, + }, + "id": "589a331aa51e760df7ccb89e", + "siteId": "580e63e98c9a982ac9b8b741", + "siteDomainId": "6419db964a9c436a4baf6248", + "pageId": "6419db964a9c43f6a3af6348", + "pageName": "Home", + "formElementId": "4e038d2c-6a1e-4953-7be9-a59a2b453177", + "workspaceId": "580e63fc8c9a982ac9b8b744", + }, + { + "displayName": "Name Form", + "createdOn": "2016-10-24T19:41:29Z", + "lastUpdated": "2016-10-24T19:43:17Z", + "fields": {"0": {"displayName": "Email", "userVisible": True}}, + "responseSettings": { + "redirectUrl": "https://example.com", + "redirectMethod": "GET", + "sendEmailConfirmation": False, + }, + "id": "580ff8d7ba3e45ba9fe588e9", + "siteId": "580e63e98c9a982ac9b8b741", + "siteDomainId": "6419db964a9c436a4baf6248", + "pageId": "6419db964a9c43f6a3af6348", + "pageName": "Home", + "formElementId": "4e038d2c-6a1e-4953-7be9-a59a2b453177", + "workspaceId": "580e63fc8c9a982ac9b8b744", + }, + ], + "pagination": {"limit": 25, "offset": 0, "total": 2}, + } + expected_types: typing.Any = { + "forms": ( + "list", + { + 0: { + "displayName": None, + "createdOn": "datetime", + "lastUpdated": "datetime", + "fields": ( + "dict", + { + 0: (None, {"displayName": None, "userVisible": None}), + 1: (None, {"displayName": None, "userVisible": None}), + }, + ), + "responseSettings": {"redirectUrl": None, "redirectMethod": None, "sendEmailConfirmation": None}, + "id": None, + "siteId": None, + "siteDomainId": None, + "pageId": None, + "pageName": None, + "formElementId": None, + "workspaceId": None, + }, + 1: { + "displayName": None, + "createdOn": "datetime", + "lastUpdated": "datetime", + "fields": ("dict", {0: (None, {"displayName": None, "userVisible": None})}), + "responseSettings": {"redirectUrl": None, "redirectMethod": None, "sendEmailConfirmation": None}, + "id": None, + "siteId": None, + "siteDomainId": None, + "pageId": None, + "pageName": None, + "formElementId": None, + "workspaceId": None, + }, + }, + ), + "pagination": {"limit": None, "offset": None, "total": None}, + } + response = client.forms.list(site_id="580e63e98c9a982ac9b8b741") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.forms.list(site_id="580e63e98c9a982ac9b8b741") + validate_response(async_response, expected_response, expected_types) + + +async def test_get(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "displayName": "Email Form", + "createdOn": "2016-10-24T19:41:29Z", + "lastUpdated": "2016-10-24T19:43:17Z", + "fields": { + "660d5bcc9c0772150459dfb1": { + "displayName": "Name", + "type": "Plain", + "placeholder": "Enter your email", + "userVisible": True, + }, + "589a331aa51e760df7ccb89d": { + "displayName": "Email", + "type": "Email", + "placeholder": "Enter your email", + "userVisible": True, + }, + }, + "responseSettings": { + "redirectUrl": "https://example.com", + "redirectMethod": "GET", + "redirectAction": "POST https://example.com", + "sendEmailConfirmation": True, + }, + "id": "589a331aa51e760df7ccb89e", + "siteId": "580e63e98c9a982ac9b8b741", + "siteDomainId": "6419db964a9c436a4baf6248", + "pageId": "6419db964a9c43f6a3af6348", + "pageName": "Home", + "formElementId": "4e038d2c-6a1e-4953-7be9-a59a2b453177", + "workspaceId": "580e63fc8c9a982ac9b8b744", + } + expected_types: typing.Any = { + "displayName": None, + "createdOn": "datetime", + "lastUpdated": "datetime", + "fields": ( + "dict", + { + 0: (None, {"displayName": None, "type": None, "placeholder": None, "userVisible": None}), + 1: (None, {"displayName": None, "type": None, "placeholder": None, "userVisible": None}), + }, + ), + "responseSettings": { + "redirectUrl": None, + "redirectMethod": None, + "redirectAction": None, + "sendEmailConfirmation": None, + }, + "id": None, + "siteId": None, + "siteDomainId": None, + "pageId": None, + "pageName": None, + "formElementId": None, + "workspaceId": None, + } + response = client.forms.get(form_id="580e63e98c9a982ac9b8b741") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.forms.get(form_id="580e63e98c9a982ac9b8b741") + validate_response(async_response, expected_response, expected_types) + + +async def test_list_submissions(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "formSubmissions": [ + { + "id": "6321ca84df3949bfc6752327", + "displayName": "Sample Form", + "siteId": "62749158efef318abc8d5a0f", + "workspaceId": "62749158efef318abc8d5a0f", + "dateSubmitted": "2022-09-14T12:35:16Z", + "formResponse": {"First Name": "Arthur", "Last Name": "Dent"}, + }, + { + "id": "660d64fabf6e0a0d4edab981", + "displayName": "Sample Form", + "siteId": "62749158efef318abc8d5a0f", + "workspaceId": "62749158efef318abc8d5a0f", + "dateSubmitted": "2022-09-14T12:35:16Z", + "formResponse": {"First Name": "Ford", "Last Name": "Prefect"}, + }, + ], + "pagination": {"limit": 25, "offset": 0, "total": 2}, + } + expected_types: typing.Any = { + "formSubmissions": ( + "list", + { + 0: { + "id": None, + "displayName": None, + "siteId": None, + "workspaceId": None, + "dateSubmitted": "datetime", + "formResponse": ("dict", {0: (None, None), 1: (None, None)}), + }, + 1: { + "id": None, + "displayName": None, + "siteId": None, + "workspaceId": None, + "dateSubmitted": "datetime", + "formResponse": ("dict", {0: (None, None), 1: (None, None)}), + }, + }, + ), + "pagination": {"limit": None, "offset": None, "total": None}, + } + response = client.forms.list_submissions(form_id="580e63e98c9a982ac9b8b741") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.forms.list_submissions(form_id="580e63e98c9a982ac9b8b741") + validate_response(async_response, expected_response, expected_types) + + +async def test_get_submission(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "id": "6321ca84df3949bfc6752327", + "displayName": "Sample Form", + "siteId": "62749158efef318abc8d5a0f", + "workspaceId": "62749158efef318abc8d5a0f", + "dateSubmitted": "2022-09-14T12:35:16Z", + "formResponse": {"First Name": "Arthur", "Last Name": "Dent"}, + } + expected_types: typing.Any = { + "id": None, + "displayName": None, + "siteId": None, + "workspaceId": None, + "dateSubmitted": "datetime", + "formResponse": ("dict", {0: (None, None), 1: (None, None)}), + } + response = client.forms.get_submission(form_submission_id="580e63e98c9a982ac9b8b741") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.forms.get_submission(form_submission_id="580e63e98c9a982ac9b8b741") + validate_response(async_response, expected_response, expected_types) + + +async def test_update_submission(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "id": "6321ca84df3949bfc6752327", + "displayName": "Sample Form", + "siteId": "62749158efef318abc8d5a0f", + "workspaceId": "62749158efef318abc8d5a0f", + "dateSubmitted": "2022-09-14T12:35:16Z", + "formResponse": {"First Name": "Arthur", "Last Name": "Dent"}, + } + expected_types: typing.Any = { + "id": None, + "displayName": None, + "siteId": None, + "workspaceId": None, + "dateSubmitted": "datetime", + "formResponse": ("dict", {0: (None, None), 1: (None, None)}), + } + response = client.forms.update_submission(form_submission_id="580e63e98c9a982ac9b8b741") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.forms.update_submission(form_submission_id="580e63e98c9a982ac9b8b741") + validate_response(async_response, expected_response, expected_types) diff --git a/tests/test_inventory.py b/tests/test_inventory.py new file mode 100644 index 0000000..1156ad6 --- /dev/null +++ b/tests/test_inventory.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from webflow import InventoryUpdateRequestInventoryType +from webflow.client import AsyncWebflow, Webflow + +from .utilities import validate_response + + +async def test_list_(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = {"id": "5bfedb42bab0ad90fa7dad39", "quantity": 100, "inventoryType": "finite"} + expected_types: typing.Any = {"id": None, "quantity": None, "inventoryType": None} + response = client.inventory.list(collection_id="580e63fc8c9a982ac9b8b745", item_id="580e64008c9a982ac9b8b754") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.inventory.list( + collection_id="580e63fc8c9a982ac9b8b745", item_id="580e64008c9a982ac9b8b754" + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_update(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = {"id": "5bfedb42bab0ad90fa7dad39", "quantity": 100, "inventoryType": "finite"} + expected_types: typing.Any = {"id": None, "quantity": None, "inventoryType": None} + response = client.inventory.update( + collection_id="580e63fc8c9a982ac9b8b745", + item_id="580e64008c9a982ac9b8b754", + inventory_type=InventoryUpdateRequestInventoryType.INFINITE, + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.inventory.update( + collection_id="580e63fc8c9a982ac9b8b745", + item_id="580e64008c9a982ac9b8b754", + inventory_type=InventoryUpdateRequestInventoryType.INFINITE, + ) + validate_response(async_response, expected_response, expected_types) diff --git a/tests/test_orders.py b/tests/test_orders.py new file mode 100644 index 0000000..ae891bd --- /dev/null +++ b/tests/test_orders.py @@ -0,0 +1,2328 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from webflow.client import AsyncWebflow, Webflow + +from .utilities import validate_response + + +async def test_list_(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "orders": [ + { + "orderId": "7c1-9fd", + "status": "unfulfilled", + "comment": "Customer requested gift wrapping and a personalized note saying: Happy Birthday, Ford! 🎉 Please ensure the item is packed with extra bubble wrap for safe transit.", + "orderComment": 'Please gift wrap with a personal note saying "Happy Birthday, Ford! 🎉', + "acceptedOn": "2024-04-10T13:16:21Z", + "fulfilledOn": "2018-12-03T22:06:15Z", + "refundedOn": "2018-12-03T22:06:15Z", + "disputedOn": "2018-12-03T22:06:15Z", + "disputeUpdatedOn": "2018-12-03T22:06:15Z", + "disputeLastStatus": "warning_needs_response", + "customerPaid": {"unit": "USD", "value": "5892", "string": " 211.55 USD"}, + "netAmount": {"unit": "USD", "value": "5892", "string": " 200.89 USD"}, + "applicationFee": {"unit": "USD", "value": "5892", "string": " 4.23 USD"}, + "allAddresses": [ + { + "type": "billing", + "addressee": "Arthur Dent", + "line1": "20 W 34th St", + "line2": "Empire State Building", + "city": "New York", + "state": "New York", + "country": "US", + "postalCode": "10118", + }, + { + "type": "shipping", + "addressee": "Arthur Dent", + "line1": "20 W 34th St", + "line2": "Empire State Building", + "city": "New York", + "state": "New York", + "country": "US", + "postalCode": "10118", + }, + ], + "shippingAddress": { + "type": "shipping", + "japanType": "kanji", + "addressee": "Arthur Dent", + "line1": "20 W 34th St", + "line2": "Empire State Building", + "city": "New York", + "state": "New York", + "country": "US", + "postalCode": "10118", + }, + "billingAddress": { + "type": "billing", + "addressee": "Arthur Dent", + "line1": "20 W 34th St", + "line2": "Empire State Building", + "city": "New York", + "state": "New York", + "country": "US", + "postalCode": "10118", + }, + "shippingProvider": "Shipping Company, Co.", + "shippingTracking": "tr00000000002", + "shippingTrackingURL": "https://www.shippingcompany.com/tracking/tr00000000002", + "customerInfo": {"fullName": "Arthur Dent", "email": "arthur.dent@example.com"}, + "purchasedItems": [ + { + "count": 2, + "rowTotal": {"unit": "USD", "value": "5892", "string": " 111.22 USD"}, + "productId": "66072fb61b89448912e26791", + "productName": "Luxurious Fresh Ball", + "productSlug": "luxurious-fresh-ball", + "variantId": "66072fb71b89448912e2683f", + "variantName": "Luxurious Fresh Ball Generic: Bronze, Practical: Plastic", + "variantSlug": "luxurious-fresh-ball-generic-bronze-practical-plastic", + "variantSKU": "luxurious-fresh-ball-generic-bronze-practical-plastic", + "variantImage": { + "url": "https://d1otoma47x30pg.cloudfront.net/66072f39417a2a35b2589cc7/66072fb51b89448912e2672c_image14.jpeg" + }, + "variantPrice": {"unit": "USD", "value": "5892", "string": " 55.61 USD"}, + "weight": 11, + "width": 82, + "height": 70, + "length": 9, + }, + { + "count": 1, + "rowTotal": {"unit": "USD", "value": "5892", "string": " 83.09 USD"}, + "productId": "66072fb61b89448912e2678b", + "productName": "Incredible Bronze Towels", + "productSlug": "incredible-bronze-towels", + "variantId": "66072fb71b89448912e2681e", + "variantName": "Incredible Bronze Towels Sleek: Frozen, Incredible: Metal", + "variantSlug": "incredible-bronze-towels-sleek-frozen-incredible-metal", + "variantSKU": "incredible-bronze-towels-sleek-frozen-incredible-metal", + "variantImage": { + "url": "https://d1otoma47x30pg.cloudfront.net/66072f39417a2a35b2589cc7/66072fb51b89448912e26729_image16.jpeg" + }, + "variantPrice": {"unit": "USD", "value": "5892", "string": " 83.09 USD"}, + "width": 19, + "height": 72, + "length": 18, + }, + ], + "purchasedItemsCount": 3, + "stripeDetails": { + "paymentMethod": "pm_1P410gJYFi4lcbXWbeKghqjK", + "paymentIntentId": "pi_3P410iJYFi4lcbXW0EKKgcVg", + "customerId": "cus_Ptod8KJBiiPgnH", + "chargeId": "ch_3P410iJYFi4lcbXW0DxUkzCH", + }, + "stripeCard": { + "last4": "4242", + "brand": "Visa", + "ownerName": "Arthur Dent", + "expires": {"year": 2025, "month": 4}, + }, + "paypalDetails": { + "orderId": "1a2b3c4d5e6f7g8h9i0j", + "payerId": "9k8j7i6h5g4f3e2d1c0b", + "captureId": "qwe123rty456uio789p", + "refundId": "abcde12345fghij67890", + "refundReason": "Customer requested refund", + "disputeId": "zxcvbnm987poiuytrewq", + }, + "customData": [{"key": "value"}], + "metadata": {"isBuyNow": False}, + "isCustomerDeleted": False, + "isShippingRequired": False, + "hasDownloads": False, + "paymentProcessor": "stripe", + "totals": { + "extras": [ + { + "type": "tax", + "name": "State Taxes", + "description": "CA Taxes (6.25%)", + "price": {"unit": "USD", "value": "5892", "string": "3.44"}, + } + ] + }, + "downloadFiles": [ + { + "id": "5e9a5eba75e0ac242e1b6f64", + "name": "The modern web design process - Webflow Ebook.pdf", + "url": "https://webflow.com/dashboard/download-digital-product?payload=5d93ba5e38c6b0160ab711d3;e7634a;5eb1aac72912ec06f561278c;5e9a5eba75e0ac242e1b6f63:ka2nehxy:4a1ee0a632feaab94294350087215ed89533f2f530903e3b933b638940e921aa", + } + ], + }, + { + "orderId": "fc7-128", + "status": "refunded", + "comment": "Example comment to myself", + "orderComment": "", + "acceptedOn": "2024-03-29T21:29:21Z", + "fulfilledOn": "2018-12-03T22:06:15Z", + "refundedOn": "2024-04-08T18:25:04Z", + "disputedOn": "2018-12-03T22:06:15Z", + "disputeUpdatedOn": "2018-12-03T22:06:15Z", + "disputeLastStatus": "warning_needs_response", + "customerPaid": {"unit": "USD", "value": "5892", "string": " 118.73 USD"}, + "netAmount": {"unit": "USD", "value": "5892", "string": " 112.62 USD"}, + "applicationFee": {"unit": "USD", "value": "5892", "string": " 2.37 USD"}, + "allAddresses": [ + { + "type": "billing", + "addressee": "Arthur Dent", + "line1": "20 W 34th St", + "line2": "Empire State Building", + "city": "New York", + "state": "New York", + "country": "US", + "postalCode": "10118", + }, + { + "type": "shipping", + "addressee": "Arthur Dent", + "line1": "20 W 34th St", + "line2": "Empire State Building", + "city": "New York", + "state": "New York", + "country": "US", + "postalCode": "10118", + }, + ], + "shippingAddress": { + "type": "shipping", + "addressee": "Arthur Dent", + "line1": "20 W 34th St", + "line2": "Empire State Building", + "city": "New York", + "state": "New York", + "country": "US", + "postalCode": "10118", + }, + "billingAddress": { + "type": "billing", + "addressee": "Arthur Dent", + "line1": "20 W 34th St", + "line2": "Empire State Building", + "city": "New York", + "state": "New York", + "country": "US", + "postalCode": "10118", + }, + "shippingProvider": "Shipping Company, Co.", + "shippingTracking": "tr00000000001", + "shippingTrackingURL": "https://www.shippingcompany.com/tracking/tr00000000001", + "customerInfo": {"fullName": "Arthur Dent", "email": "arthur.dent@example.com"}, + "purchasedItems": [ + { + "count": 1, + "rowTotal": {"unit": "USD", "value": "5892", "string": " 55.61 USD"}, + "productId": "66072fb61b89448912e26791", + "productName": "Luxurious Fresh Ball", + "productSlug": "luxurious-fresh-ball", + "variantId": "66072fb71b89448912e2683f", + "variantName": "Luxurious Fresh Ball Generic: Bronze, Practical: Plastic", + "variantSlug": "luxurious-fresh-ball-generic-bronze-practical-plastic", + "variantSKU": "luxurious-fresh-ball-generic-bronze-practical-plastic", + "variantImage": { + "url": "https://d1otoma47x30pg.cloudfront.net/66072f39417a2a35b2589cc7/66072fb51b89448912e2672c_image14.jpeg" + }, + "variantPrice": {"unit": "USD", "value": "5892", "string": " 55.61 USD"}, + "weight": 11, + "width": 82, + "height": 70, + "length": 9, + }, + { + "count": 1, + "rowTotal": {"unit": "USD", "value": "5892", "string": " 53.44 USD"}, + "productId": "66072fb61b89448912e26799", + "productName": "Recycled Steel Gloves", + "productSlug": "recycled-steel-gloves", + "variantId": "66072fb91b89448912e26ab9", + "variantName": "Recycled Steel Gloves Electronic: Granite, Handcrafted: grey", + "variantSlug": "recycled-steel-gloves-electronic-granite-handcrafted-grey", + "variantSKU": "recycled-steel-gloves-electronic-granite-handcrafted-grey", + "variantImage": { + "url": "https://d1otoma47x30pg.cloudfront.net/66072f39417a2a35b2589cc7/66072fb51b89448912e2671e_image2.jpeg" + }, + "variantPrice": {"unit": "USD", "value": "5892", "string": " 53.44 USD"}, + "weight": 38, + "width": 76, + "height": 85, + "length": 40, + }, + ], + "purchasedItemsCount": 2, + "stripeDetails": { + "paymentMethod": "pm_1OzmzBJYFi4lcbXWHKNdXU7j", + "paymentIntentId": "pi_3OzmzDJYFi4lcbXW1hTBW6ft", + "customerId": "cus_PpRsNHwWdUoRKR", + "chargeId": "ch_3OzmzDJYFi4lcbXW1ndkkrH2", + "refundId": "re_3OzmzDJYFi4lcbXW1kFAmlBk", + "refundReason": "fraudulent", + }, + "stripeCard": { + "last4": "4242", + "brand": "Visa", + "ownerName": "Arthur Dent", + "expires": {"year": 2024, "month": 4}, + }, + "paypalDetails": { + "orderId": "1a2b3c4d5e6f7g8h9i0j", + "payerId": "9k8j7i6h5g4f3e2d1c0b", + "captureId": "qwe123rty456uio789p", + "refundId": "abcde12345fghij67890", + "refundReason": "Customer requested refund", + "disputeId": "zxcvbnm987poiuytrewq", + }, + "customData": [{"key": "value"}], + "metadata": {"isBuyNow": False}, + "isCustomerDeleted": False, + "isShippingRequired": True, + "hasDownloads": False, + "paymentProcessor": "stripe", + "totals": { + "subtotal": {"unit": "USD", "value": "5892", "string": " 109.05 USD"}, + "extras": [ + { + "type": "tax", + "name": "State Taxes", + "description": "NY Taxes (4.00%)", + "price": {"unit": "USD", "value": "5892", "string": " 4.36 USD"}, + }, + { + "type": "tax", + "name": "City Taxes", + "description": "NEW YORK Taxes (4.88%)", + "price": {"unit": "USD", "value": "5892", "string": " 5.32 USD"}, + }, + { + "type": "shipping", + "name": "Flat", + "description": "", + "price": {"unit": "USD", "value": "5892", "string": " 0.00 USD"}, + }, + ], + "total": {"unit": "USD", "value": "5892", "string": " 118.73 USD"}, + }, + "downloadFiles": [ + { + "id": "5e9a5eba75e0ac242e1b6f64", + "name": "New product guide", + "url": "https://webflow.com/dashboard/download-digital-product?payload=5d93ba5e38c6b0160ab711d3;e7634a;5eb1aac72912ec06f561278c;5e9a5eba75e0ac242e1b6f63:ka2nehxy:4a1ee0a632feaab94294350087215ed89533f2f530903e3b933b638940e921aa", + } + ], + }, + ], + "pagination": {"limit": 100, "offset": 0, "total": 2}, + } + expected_types: typing.Any = { + "orders": ( + "list", + { + 0: { + "orderId": None, + "status": None, + "comment": None, + "orderComment": None, + "acceptedOn": "datetime", + "fulfilledOn": "datetime", + "refundedOn": "datetime", + "disputedOn": "datetime", + "disputeUpdatedOn": "datetime", + "disputeLastStatus": None, + "customerPaid": {"unit": None, "value": None, "string": None}, + "netAmount": {"unit": None, "value": None, "string": None}, + "applicationFee": {"unit": None, "value": None, "string": None}, + "allAddresses": ( + "list", + { + 0: { + "type": None, + "addressee": None, + "line1": None, + "line2": None, + "city": None, + "state": None, + "country": None, + "postalCode": None, + }, + 1: { + "type": None, + "addressee": None, + "line1": None, + "line2": None, + "city": None, + "state": None, + "country": None, + "postalCode": None, + }, + }, + ), + "shippingAddress": { + "type": None, + "japanType": None, + "addressee": None, + "line1": None, + "line2": None, + "city": None, + "state": None, + "country": None, + "postalCode": None, + }, + "billingAddress": { + "type": None, + "addressee": None, + "line1": None, + "line2": None, + "city": None, + "state": None, + "country": None, + "postalCode": None, + }, + "shippingProvider": None, + "shippingTracking": None, + "shippingTrackingURL": None, + "customerInfo": {"fullName": None, "email": None}, + "purchasedItems": ( + "list", + { + 0: { + "count": None, + "rowTotal": {"unit": None, "value": None, "string": None}, + "productId": None, + "productName": None, + "productSlug": None, + "variantId": None, + "variantName": None, + "variantSlug": None, + "variantSKU": None, + "variantImage": {"url": None}, + "variantPrice": {"unit": None, "value": None, "string": None}, + "weight": None, + "width": None, + "height": None, + "length": None, + }, + 1: { + "count": None, + "rowTotal": {"unit": None, "value": None, "string": None}, + "productId": None, + "productName": None, + "productSlug": None, + "variantId": None, + "variantName": None, + "variantSlug": None, + "variantSKU": None, + "variantImage": {"url": None}, + "variantPrice": {"unit": None, "value": None, "string": None}, + "width": None, + "height": None, + "length": None, + }, + }, + ), + "purchasedItemsCount": None, + "stripeDetails": { + "paymentMethod": None, + "paymentIntentId": None, + "customerId": None, + "chargeId": None, + }, + "stripeCard": { + "last4": None, + "brand": None, + "ownerName": None, + "expires": {"year": None, "month": None}, + }, + "paypalDetails": { + "orderId": None, + "payerId": None, + "captureId": None, + "refundId": None, + "refundReason": None, + "disputeId": None, + }, + "customData": ("list", {0: ("dict", {0: (None, None)})}), + "metadata": {"isBuyNow": None}, + "isCustomerDeleted": None, + "isShippingRequired": None, + "hasDownloads": None, + "paymentProcessor": None, + "totals": { + "extras": ( + "list", + { + 0: { + "type": None, + "name": None, + "description": None, + "price": {"unit": None, "value": None, "string": None}, + } + }, + ) + }, + "downloadFiles": ("list", {0: {"id": None, "name": None, "url": None}}), + }, + 1: { + "orderId": None, + "status": None, + "comment": None, + "orderComment": None, + "acceptedOn": "datetime", + "fulfilledOn": "datetime", + "refundedOn": "datetime", + "disputedOn": "datetime", + "disputeUpdatedOn": "datetime", + "disputeLastStatus": None, + "customerPaid": {"unit": None, "value": None, "string": None}, + "netAmount": {"unit": None, "value": None, "string": None}, + "applicationFee": {"unit": None, "value": None, "string": None}, + "allAddresses": ( + "list", + { + 0: { + "type": None, + "addressee": None, + "line1": None, + "line2": None, + "city": None, + "state": None, + "country": None, + "postalCode": None, + }, + 1: { + "type": None, + "addressee": None, + "line1": None, + "line2": None, + "city": None, + "state": None, + "country": None, + "postalCode": None, + }, + }, + ), + "shippingAddress": { + "type": None, + "addressee": None, + "line1": None, + "line2": None, + "city": None, + "state": None, + "country": None, + "postalCode": None, + }, + "billingAddress": { + "type": None, + "addressee": None, + "line1": None, + "line2": None, + "city": None, + "state": None, + "country": None, + "postalCode": None, + }, + "shippingProvider": None, + "shippingTracking": None, + "shippingTrackingURL": None, + "customerInfo": {"fullName": None, "email": None}, + "purchasedItems": ( + "list", + { + 0: { + "count": None, + "rowTotal": {"unit": None, "value": None, "string": None}, + "productId": None, + "productName": None, + "productSlug": None, + "variantId": None, + "variantName": None, + "variantSlug": None, + "variantSKU": None, + "variantImage": {"url": None}, + "variantPrice": {"unit": None, "value": None, "string": None}, + "weight": None, + "width": None, + "height": None, + "length": None, + }, + 1: { + "count": None, + "rowTotal": {"unit": None, "value": None, "string": None}, + "productId": None, + "productName": None, + "productSlug": None, + "variantId": None, + "variantName": None, + "variantSlug": None, + "variantSKU": None, + "variantImage": {"url": None}, + "variantPrice": {"unit": None, "value": None, "string": None}, + "weight": None, + "width": None, + "height": None, + "length": None, + }, + }, + ), + "purchasedItemsCount": None, + "stripeDetails": { + "paymentMethod": None, + "paymentIntentId": None, + "customerId": None, + "chargeId": None, + "refundId": None, + "refundReason": None, + }, + "stripeCard": { + "last4": None, + "brand": None, + "ownerName": None, + "expires": {"year": None, "month": None}, + }, + "paypalDetails": { + "orderId": None, + "payerId": None, + "captureId": None, + "refundId": None, + "refundReason": None, + "disputeId": None, + }, + "customData": ("list", {0: ("dict", {0: (None, None)})}), + "metadata": {"isBuyNow": None}, + "isCustomerDeleted": None, + "isShippingRequired": None, + "hasDownloads": None, + "paymentProcessor": None, + "totals": { + "subtotal": {"unit": None, "value": None, "string": None}, + "extras": ( + "list", + { + 0: { + "type": None, + "name": None, + "description": None, + "price": {"unit": None, "value": None, "string": None}, + }, + 1: { + "type": None, + "name": None, + "description": None, + "price": {"unit": None, "value": None, "string": None}, + }, + 2: { + "type": None, + "name": None, + "description": None, + "price": {"unit": None, "value": None, "string": None}, + }, + }, + ), + "total": {"unit": None, "value": None, "string": None}, + }, + "downloadFiles": ("list", {0: {"id": None, "name": None, "url": None}}), + }, + }, + ), + "pagination": {"limit": None, "offset": None, "total": None}, + } + response = client.orders.list(site_id="580e63e98c9a982ac9b8b741") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.orders.list(site_id="580e63e98c9a982ac9b8b741") + validate_response(async_response, expected_response, expected_types) + + +async def test_get(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "orderId": "fc7-128", + "status": "refunded", + "comment": "Customer requested gift wrapping and a personalized note saying: Happy Birthday, Ford! 🎉 Please ensure the item is packed with extra bubble wrap for safe transit.", + "orderComment": 'Please gift wrap with a personal note saying "Happy Birthday, Ford! 🎉', + "acceptedOn": "2024-03-29T21:29:21Z", + "fulfilledOn": "2024-03-29T21:29:21Z", + "refundedOn": "2024-04-08T18:25:04Z", + "disputedOn": "2024-03-29T21:29:21Z", + "disputeUpdatedOn": "2024-03-29T21:29:21Z", + "disputeLastStatus": "charge_refunded", + "customerPaid": {"unit": "USD", "value": "5892", "string": " 118.73 USD"}, + "netAmount": {"unit": "USD", "value": "5892", "string": " 112.62 USD"}, + "applicationFee": {"unit": "USD", "value": "5892", "string": " 2.37 USD"}, + "allAddresses": [ + { + "type": "billing", + "japanType": "kana", + "addressee": "Arthur Dent", + "line1": "20 W 34th St", + "line2": "Empire State Building", + "city": "New York", + "state": "New York", + "country": "US", + "postalCode": "10118", + }, + { + "type": "shipping", + "japanType": "kana", + "addressee": "Arthur Dent", + "line1": "20 W 34th St", + "line2": "Empire State Building", + "city": "New York", + "state": "New York", + "country": "US", + "postalCode": "10118", + }, + ], + "shippingAddress": { + "type": "shipping", + "japanType": "kanji", + "addressee": "Arthur Dent", + "line1": "20 W 34th St", + "line2": "Empire State Building", + "city": "New York", + "state": "New York", + "country": "US", + "postalCode": "10118", + }, + "billingAddress": { + "type": "billing", + "japanType": "kana", + "addressee": "Arthur Dent", + "line1": "20 W 34th St", + "line2": "Empire State Building", + "city": "New York", + "state": "New York", + "country": "US", + "postalCode": "10118", + }, + "shippingProvider": "Shipping Company, Co.", + "shippingTracking": "tr00000000001", + "shippingTrackingURL": "https://www.shippingcompany.com/tracking/tr00000000001", + "customerInfo": {"fullName": "Arthur Dent", "email": "arthur.dent@example.com"}, + "purchasedItems": [ + { + "count": 1, + "rowTotal": {"unit": "USD", "value": "5892", "string": " 55.61 USD"}, + "productId": "66072fb61b89448912e26791", + "productName": "Luxurious Fresh Ball", + "productSlug": "luxurious-fresh-ball", + "variantId": "66072fb71b89448912e2683f", + "variantName": "Luxurious Fresh Ball Generic: Bronze, Practical: Plastic", + "variantSlug": "luxurious-fresh-ball-generic-bronze-practical-plastic", + "variantSKU": "luxurious-fresh-ball-generic-bronze-practical-plastic", + "variantImage": { + "url": "https://d1otoma47x30pg.cloudfront.net/66072f39417a2a35b2589cc7/66072fb51b89448912e2672c_image14.jpeg" + }, + "variantPrice": {"unit": "USD", "value": "5892", "string": " 55.61 USD"}, + "weight": 11, + "width": 82, + "height": 70, + "length": 9, + }, + { + "count": 1, + "rowTotal": {"unit": "USD", "value": "5892", "string": " 53.44 USD"}, + "productId": "66072fb61b89448912e26799", + "productName": "Recycled Steel Gloves", + "productSlug": "recycled-steel-gloves", + "variantId": "66072fb91b89448912e26ab9", + "variantName": "Recycled Steel Gloves Electronic: Granite, Handcrafted: grey", + "variantSlug": "recycled-steel-gloves-electronic-granite-handcrafted-grey", + "variantSKU": "recycled-steel-gloves-electronic-granite-handcrafted-grey", + "variantImage": { + "url": "https://d1otoma47x30pg.cloudfront.net/66072f39417a2a35b2589cc7/66072fb51b89448912e2671e_image2.jpeg" + }, + "variantPrice": {"unit": "USD", "value": "5892", "string": " 53.44 USD"}, + "weight": 38, + "width": 76, + "height": 85, + "length": 40, + }, + ], + "purchasedItemsCount": 2, + "stripeDetails": { + "subscriptionId": "sub_1J6xwG2eZvKYlo2CXu9Zt0Tn", + "paymentMethod": "pm_1OzmzBJYFi4lcbXWHKNdXU7j", + "paymentIntentId": "pi_3OzmzDJYFi4lcbXW1hTBW6ft", + "customerId": "cus_PpRsNHwWdUoRKR", + "chargeId": "ch_3OzmzDJYFi4lcbXW1ndkkrH2", + "disputeId": "disputeId", + "refundId": "re_3OzmzDJYFi4lcbXW1kFAmlBk", + "refundReason": "fraudulent", + }, + "stripeCard": { + "last4": "4242", + "brand": "Visa", + "ownerName": "Arthur Dent", + "expires": {"year": 2024, "month": 4}, + }, + "paypalDetails": { + "orderId": "1a2b3c4d5e6f7g8h9i0j", + "payerId": "9k8j7i6h5g4f3e2d1c0b", + "captureId": "qwe123rty456uio789p", + "refundId": "abcde12345fghij67890", + "refundReason": "Customer requested refund", + "disputeId": "zxcvbnm987poiuytrewq", + }, + "customData": [{"key": "value"}], + "metadata": {"isBuyNow": False}, + "isCustomerDeleted": False, + "isShippingRequired": True, + "hasDownloads": False, + "paymentProcessor": "stripe", + "totals": { + "subtotal": {"unit": "USD", "value": "5892", "string": " 109.05 USD"}, + "extras": [ + { + "type": "tax", + "name": "State Taxes", + "description": "NY Taxes (4.00%)", + "price": {"unit": "USD", "value": "5892", "string": " 4.36 USD"}, + }, + { + "type": "tax", + "name": "City Taxes", + "description": "NEW YORK Taxes (4.88%)", + "price": {"unit": "USD", "value": "5892", "string": " 5.32 USD"}, + }, + { + "type": "shipping", + "name": "Flat", + "description": "", + "price": {"unit": "USD", "value": "5892", "string": " 0.00 USD"}, + }, + ], + "total": {"unit": "USD", "value": "5892", "string": " 118.73 USD"}, + }, + "downloadFiles": [ + { + "id": "5e9a5eba75e0ac242e1b6f64", + "name": "New product guide", + "url": "https://webflow.com/dashboard/download-digital-product?payload=5d93ba5e38c6b0160ab711d3;e7634a;5eb1aac72912ec06f561278c;5e9a5eba75e0ac242e1b6f63:ka2nehxy:4a1ee0a632feaab94294350087215ed89533f2f530903e3b933b638940e921aa", + } + ], + } + expected_types: typing.Any = { + "orderId": None, + "status": None, + "comment": None, + "orderComment": None, + "acceptedOn": "datetime", + "fulfilledOn": "datetime", + "refundedOn": "datetime", + "disputedOn": "datetime", + "disputeUpdatedOn": "datetime", + "disputeLastStatus": None, + "customerPaid": {"unit": None, "value": None, "string": None}, + "netAmount": {"unit": None, "value": None, "string": None}, + "applicationFee": {"unit": None, "value": None, "string": None}, + "allAddresses": ( + "list", + { + 0: { + "type": None, + "japanType": None, + "addressee": None, + "line1": None, + "line2": None, + "city": None, + "state": None, + "country": None, + "postalCode": None, + }, + 1: { + "type": None, + "japanType": None, + "addressee": None, + "line1": None, + "line2": None, + "city": None, + "state": None, + "country": None, + "postalCode": None, + }, + }, + ), + "shippingAddress": { + "type": None, + "japanType": None, + "addressee": None, + "line1": None, + "line2": None, + "city": None, + "state": None, + "country": None, + "postalCode": None, + }, + "billingAddress": { + "type": None, + "japanType": None, + "addressee": None, + "line1": None, + "line2": None, + "city": None, + "state": None, + "country": None, + "postalCode": None, + }, + "shippingProvider": None, + "shippingTracking": None, + "shippingTrackingURL": None, + "customerInfo": {"fullName": None, "email": None}, + "purchasedItems": ( + "list", + { + 0: { + "count": None, + "rowTotal": {"unit": None, "value": None, "string": None}, + "productId": None, + "productName": None, + "productSlug": None, + "variantId": None, + "variantName": None, + "variantSlug": None, + "variantSKU": None, + "variantImage": {"url": None}, + "variantPrice": {"unit": None, "value": None, "string": None}, + "weight": None, + "width": None, + "height": None, + "length": None, + }, + 1: { + "count": None, + "rowTotal": {"unit": None, "value": None, "string": None}, + "productId": None, + "productName": None, + "productSlug": None, + "variantId": None, + "variantName": None, + "variantSlug": None, + "variantSKU": None, + "variantImage": {"url": None}, + "variantPrice": {"unit": None, "value": None, "string": None}, + "weight": None, + "width": None, + "height": None, + "length": None, + }, + }, + ), + "purchasedItemsCount": None, + "stripeDetails": { + "subscriptionId": None, + "paymentMethod": None, + "paymentIntentId": None, + "customerId": None, + "chargeId": None, + "disputeId": None, + "refundId": None, + "refundReason": None, + }, + "stripeCard": {"last4": None, "brand": None, "ownerName": None, "expires": {"year": None, "month": None}}, + "paypalDetails": { + "orderId": None, + "payerId": None, + "captureId": None, + "refundId": None, + "refundReason": None, + "disputeId": None, + }, + "customData": ("list", {0: ("dict", {0: (None, None)})}), + "metadata": {"isBuyNow": None}, + "isCustomerDeleted": None, + "isShippingRequired": None, + "hasDownloads": None, + "paymentProcessor": None, + "totals": { + "subtotal": {"unit": None, "value": None, "string": None}, + "extras": ( + "list", + { + 0: { + "type": None, + "name": None, + "description": None, + "price": {"unit": None, "value": None, "string": None}, + }, + 1: { + "type": None, + "name": None, + "description": None, + "price": {"unit": None, "value": None, "string": None}, + }, + 2: { + "type": None, + "name": None, + "description": None, + "price": {"unit": None, "value": None, "string": None}, + }, + }, + ), + "total": {"unit": None, "value": None, "string": None}, + }, + "downloadFiles": ("list", {0: {"id": None, "name": None, "url": None}}), + } + response = client.orders.get(site_id="580e63e98c9a982ac9b8b741", order_id="5e8518516e147040726cc415") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.orders.get( + site_id="580e63e98c9a982ac9b8b741", order_id="5e8518516e147040726cc415" + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_update(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "orderId": "fc7-128", + "status": "refunded", + "comment": "Customer requested gift wrapping and a personalized note saying: Happy Birthday, Ford! 🎉 Please ensure the item is packed with extra bubble wrap for safe transit.", + "orderComment": 'Please gift wrap with a personal note saying "Happy Birthday, Ford! 🎉', + "acceptedOn": "2024-03-29T21:29:21Z", + "fulfilledOn": "2024-03-29T21:29:21Z", + "refundedOn": "2024-04-08T18:25:04Z", + "disputedOn": "2024-03-29T21:29:21Z", + "disputeUpdatedOn": "2024-03-29T21:29:21Z", + "disputeLastStatus": "charge_refunded", + "customerPaid": {"unit": "USD", "value": "5892", "string": " 118.73 USD"}, + "netAmount": {"unit": "USD", "value": "5892", "string": " 112.62 USD"}, + "applicationFee": {"unit": "USD", "value": "5892", "string": " 2.37 USD"}, + "allAddresses": [ + { + "type": "billing", + "japanType": "kana", + "addressee": "Arthur Dent", + "line1": "20 W 34th St", + "line2": "Empire State Building", + "city": "New York", + "state": "New York", + "country": "US", + "postalCode": "10118", + }, + { + "type": "shipping", + "japanType": "kana", + "addressee": "Arthur Dent", + "line1": "20 W 34th St", + "line2": "Empire State Building", + "city": "New York", + "state": "New York", + "country": "US", + "postalCode": "10118", + }, + ], + "shippingAddress": { + "type": "shipping", + "japanType": "kanji", + "addressee": "Arthur Dent", + "line1": "20 W 34th St", + "line2": "Empire State Building", + "city": "New York", + "state": "New York", + "country": "US", + "postalCode": "10118", + }, + "billingAddress": { + "type": "billing", + "japanType": "kana", + "addressee": "Arthur Dent", + "line1": "20 W 34th St", + "line2": "Empire State Building", + "city": "New York", + "state": "New York", + "country": "US", + "postalCode": "10118", + }, + "shippingProvider": "Shipping Company, Co.", + "shippingTracking": "tr00000000001", + "shippingTrackingURL": "https://www.shippingcompany.com/tracking/tr00000000001", + "customerInfo": {"fullName": "Arthur Dent", "email": "arthur.dent@example.com"}, + "purchasedItems": [ + { + "count": 1, + "rowTotal": {"unit": "USD", "value": "5892", "string": " 55.61 USD"}, + "productId": "66072fb61b89448912e26791", + "productName": "Luxurious Fresh Ball", + "productSlug": "luxurious-fresh-ball", + "variantId": "66072fb71b89448912e2683f", + "variantName": "Luxurious Fresh Ball Generic: Bronze, Practical: Plastic", + "variantSlug": "luxurious-fresh-ball-generic-bronze-practical-plastic", + "variantSKU": "luxurious-fresh-ball-generic-bronze-practical-plastic", + "variantImage": { + "url": "https://d1otoma47x30pg.cloudfront.net/66072f39417a2a35b2589cc7/66072fb51b89448912e2672c_image14.jpeg" + }, + "variantPrice": {"unit": "USD", "value": "5892", "string": " 55.61 USD"}, + "weight": 11, + "width": 82, + "height": 70, + "length": 9, + }, + { + "count": 1, + "rowTotal": {"unit": "USD", "value": "5892", "string": " 53.44 USD"}, + "productId": "66072fb61b89448912e26799", + "productName": "Recycled Steel Gloves", + "productSlug": "recycled-steel-gloves", + "variantId": "66072fb91b89448912e26ab9", + "variantName": "Recycled Steel Gloves Electronic: Granite, Handcrafted: grey", + "variantSlug": "recycled-steel-gloves-electronic-granite-handcrafted-grey", + "variantSKU": "recycled-steel-gloves-electronic-granite-handcrafted-grey", + "variantImage": { + "url": "https://d1otoma47x30pg.cloudfront.net/66072f39417a2a35b2589cc7/66072fb51b89448912e2671e_image2.jpeg" + }, + "variantPrice": {"unit": "USD", "value": "5892", "string": " 53.44 USD"}, + "weight": 38, + "width": 76, + "height": 85, + "length": 40, + }, + ], + "purchasedItemsCount": 2, + "stripeDetails": { + "subscriptionId": "sub_1J6xwG2eZvKYlo2CXu9Zt0Tn", + "paymentMethod": "pm_1OzmzBJYFi4lcbXWHKNdXU7j", + "paymentIntentId": "pi_3OzmzDJYFi4lcbXW1hTBW6ft", + "customerId": "cus_PpRsNHwWdUoRKR", + "chargeId": "ch_3OzmzDJYFi4lcbXW1ndkkrH2", + "disputeId": "disputeId", + "refundId": "re_3OzmzDJYFi4lcbXW1kFAmlBk", + "refundReason": "fraudulent", + }, + "stripeCard": { + "last4": "4242", + "brand": "Visa", + "ownerName": "Arthur Dent", + "expires": {"year": 2024, "month": 4}, + }, + "paypalDetails": { + "orderId": "1a2b3c4d5e6f7g8h9i0j", + "payerId": "9k8j7i6h5g4f3e2d1c0b", + "captureId": "qwe123rty456uio789p", + "refundId": "abcde12345fghij67890", + "refundReason": "Customer requested refund", + "disputeId": "zxcvbnm987poiuytrewq", + }, + "customData": [{"key": "value"}], + "metadata": {"isBuyNow": False}, + "isCustomerDeleted": False, + "isShippingRequired": True, + "hasDownloads": False, + "paymentProcessor": "stripe", + "totals": { + "subtotal": {"unit": "USD", "value": "5892", "string": " 109.05 USD"}, + "extras": [ + { + "type": "tax", + "name": "State Taxes", + "description": "NY Taxes (4.00%)", + "price": {"unit": "USD", "value": "5892", "string": " 4.36 USD"}, + }, + { + "type": "tax", + "name": "City Taxes", + "description": "NEW YORK Taxes (4.88%)", + "price": {"unit": "USD", "value": "5892", "string": " 5.32 USD"}, + }, + { + "type": "shipping", + "name": "Flat", + "description": "", + "price": {"unit": "USD", "value": "5892", "string": " 0.00 USD"}, + }, + ], + "total": {"unit": "USD", "value": "5892", "string": " 118.73 USD"}, + }, + "downloadFiles": [ + { + "id": "5e9a5eba75e0ac242e1b6f64", + "name": "New product guide", + "url": "https://webflow.com/dashboard/download-digital-product?payload=5d93ba5e38c6b0160ab711d3;e7634a;5eb1aac72912ec06f561278c;5e9a5eba75e0ac242e1b6f63:ka2nehxy:4a1ee0a632feaab94294350087215ed89533f2f530903e3b933b638940e921aa", + } + ], + } + expected_types: typing.Any = { + "orderId": None, + "status": None, + "comment": None, + "orderComment": None, + "acceptedOn": "datetime", + "fulfilledOn": "datetime", + "refundedOn": "datetime", + "disputedOn": "datetime", + "disputeUpdatedOn": "datetime", + "disputeLastStatus": None, + "customerPaid": {"unit": None, "value": None, "string": None}, + "netAmount": {"unit": None, "value": None, "string": None}, + "applicationFee": {"unit": None, "value": None, "string": None}, + "allAddresses": ( + "list", + { + 0: { + "type": None, + "japanType": None, + "addressee": None, + "line1": None, + "line2": None, + "city": None, + "state": None, + "country": None, + "postalCode": None, + }, + 1: { + "type": None, + "japanType": None, + "addressee": None, + "line1": None, + "line2": None, + "city": None, + "state": None, + "country": None, + "postalCode": None, + }, + }, + ), + "shippingAddress": { + "type": None, + "japanType": None, + "addressee": None, + "line1": None, + "line2": None, + "city": None, + "state": None, + "country": None, + "postalCode": None, + }, + "billingAddress": { + "type": None, + "japanType": None, + "addressee": None, + "line1": None, + "line2": None, + "city": None, + "state": None, + "country": None, + "postalCode": None, + }, + "shippingProvider": None, + "shippingTracking": None, + "shippingTrackingURL": None, + "customerInfo": {"fullName": None, "email": None}, + "purchasedItems": ( + "list", + { + 0: { + "count": None, + "rowTotal": {"unit": None, "value": None, "string": None}, + "productId": None, + "productName": None, + "productSlug": None, + "variantId": None, + "variantName": None, + "variantSlug": None, + "variantSKU": None, + "variantImage": {"url": None}, + "variantPrice": {"unit": None, "value": None, "string": None}, + "weight": None, + "width": None, + "height": None, + "length": None, + }, + 1: { + "count": None, + "rowTotal": {"unit": None, "value": None, "string": None}, + "productId": None, + "productName": None, + "productSlug": None, + "variantId": None, + "variantName": None, + "variantSlug": None, + "variantSKU": None, + "variantImage": {"url": None}, + "variantPrice": {"unit": None, "value": None, "string": None}, + "weight": None, + "width": None, + "height": None, + "length": None, + }, + }, + ), + "purchasedItemsCount": None, + "stripeDetails": { + "subscriptionId": None, + "paymentMethod": None, + "paymentIntentId": None, + "customerId": None, + "chargeId": None, + "disputeId": None, + "refundId": None, + "refundReason": None, + }, + "stripeCard": {"last4": None, "brand": None, "ownerName": None, "expires": {"year": None, "month": None}}, + "paypalDetails": { + "orderId": None, + "payerId": None, + "captureId": None, + "refundId": None, + "refundReason": None, + "disputeId": None, + }, + "customData": ("list", {0: ("dict", {0: (None, None)})}), + "metadata": {"isBuyNow": None}, + "isCustomerDeleted": None, + "isShippingRequired": None, + "hasDownloads": None, + "paymentProcessor": None, + "totals": { + "subtotal": {"unit": None, "value": None, "string": None}, + "extras": ( + "list", + { + 0: { + "type": None, + "name": None, + "description": None, + "price": {"unit": None, "value": None, "string": None}, + }, + 1: { + "type": None, + "name": None, + "description": None, + "price": {"unit": None, "value": None, "string": None}, + }, + 2: { + "type": None, + "name": None, + "description": None, + "price": {"unit": None, "value": None, "string": None}, + }, + }, + ), + "total": {"unit": None, "value": None, "string": None}, + }, + "downloadFiles": ("list", {0: {"id": None, "name": None, "url": None}}), + } + response = client.orders.update(site_id="580e63e98c9a982ac9b8b741", order_id="5e8518516e147040726cc415") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.orders.update( + site_id="580e63e98c9a982ac9b8b741", order_id="5e8518516e147040726cc415" + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_update_fulfill(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "orderId": "fc7-128", + "status": "refunded", + "comment": "Customer requested gift wrapping and a personalized note saying: Happy Birthday, Ford! 🎉 Please ensure the item is packed with extra bubble wrap for safe transit.", + "orderComment": 'Please gift wrap with a personal note saying "Happy Birthday, Ford! 🎉', + "acceptedOn": "2024-03-29T21:29:21Z", + "fulfilledOn": "2024-03-29T21:29:21Z", + "refundedOn": "2024-04-08T18:25:04Z", + "disputedOn": "2024-03-29T21:29:21Z", + "disputeUpdatedOn": "2024-03-29T21:29:21Z", + "disputeLastStatus": "charge_refunded", + "customerPaid": {"unit": "USD", "value": "5892", "string": " 118.73 USD"}, + "netAmount": {"unit": "USD", "value": "5892", "string": " 112.62 USD"}, + "applicationFee": {"unit": "USD", "value": "5892", "string": " 2.37 USD"}, + "allAddresses": [ + { + "type": "billing", + "japanType": "kana", + "addressee": "Arthur Dent", + "line1": "20 W 34th St", + "line2": "Empire State Building", + "city": "New York", + "state": "New York", + "country": "US", + "postalCode": "10118", + }, + { + "type": "shipping", + "japanType": "kana", + "addressee": "Arthur Dent", + "line1": "20 W 34th St", + "line2": "Empire State Building", + "city": "New York", + "state": "New York", + "country": "US", + "postalCode": "10118", + }, + ], + "shippingAddress": { + "type": "shipping", + "japanType": "kanji", + "addressee": "Arthur Dent", + "line1": "20 W 34th St", + "line2": "Empire State Building", + "city": "New York", + "state": "New York", + "country": "US", + "postalCode": "10118", + }, + "billingAddress": { + "type": "billing", + "japanType": "kana", + "addressee": "Arthur Dent", + "line1": "20 W 34th St", + "line2": "Empire State Building", + "city": "New York", + "state": "New York", + "country": "US", + "postalCode": "10118", + }, + "shippingProvider": "Shipping Company, Co.", + "shippingTracking": "tr00000000001", + "shippingTrackingURL": "https://www.shippingcompany.com/tracking/tr00000000001", + "customerInfo": {"fullName": "Arthur Dent", "email": "arthur.dent@example.com"}, + "purchasedItems": [ + { + "count": 1, + "rowTotal": {"unit": "USD", "value": "5892", "string": " 55.61 USD"}, + "productId": "66072fb61b89448912e26791", + "productName": "Luxurious Fresh Ball", + "productSlug": "luxurious-fresh-ball", + "variantId": "66072fb71b89448912e2683f", + "variantName": "Luxurious Fresh Ball Generic: Bronze, Practical: Plastic", + "variantSlug": "luxurious-fresh-ball-generic-bronze-practical-plastic", + "variantSKU": "luxurious-fresh-ball-generic-bronze-practical-plastic", + "variantImage": { + "url": "https://d1otoma47x30pg.cloudfront.net/66072f39417a2a35b2589cc7/66072fb51b89448912e2672c_image14.jpeg" + }, + "variantPrice": {"unit": "USD", "value": "5892", "string": " 55.61 USD"}, + "weight": 11, + "width": 82, + "height": 70, + "length": 9, + }, + { + "count": 1, + "rowTotal": {"unit": "USD", "value": "5892", "string": " 53.44 USD"}, + "productId": "66072fb61b89448912e26799", + "productName": "Recycled Steel Gloves", + "productSlug": "recycled-steel-gloves", + "variantId": "66072fb91b89448912e26ab9", + "variantName": "Recycled Steel Gloves Electronic: Granite, Handcrafted: grey", + "variantSlug": "recycled-steel-gloves-electronic-granite-handcrafted-grey", + "variantSKU": "recycled-steel-gloves-electronic-granite-handcrafted-grey", + "variantImage": { + "url": "https://d1otoma47x30pg.cloudfront.net/66072f39417a2a35b2589cc7/66072fb51b89448912e2671e_image2.jpeg" + }, + "variantPrice": {"unit": "USD", "value": "5892", "string": " 53.44 USD"}, + "weight": 38, + "width": 76, + "height": 85, + "length": 40, + }, + ], + "purchasedItemsCount": 2, + "stripeDetails": { + "subscriptionId": "sub_1J6xwG2eZvKYlo2CXu9Zt0Tn", + "paymentMethod": "pm_1OzmzBJYFi4lcbXWHKNdXU7j", + "paymentIntentId": "pi_3OzmzDJYFi4lcbXW1hTBW6ft", + "customerId": "cus_PpRsNHwWdUoRKR", + "chargeId": "ch_3OzmzDJYFi4lcbXW1ndkkrH2", + "disputeId": "disputeId", + "refundId": "re_3OzmzDJYFi4lcbXW1kFAmlBk", + "refundReason": "fraudulent", + }, + "stripeCard": { + "last4": "4242", + "brand": "Visa", + "ownerName": "Arthur Dent", + "expires": {"year": 2024, "month": 4}, + }, + "paypalDetails": { + "orderId": "1a2b3c4d5e6f7g8h9i0j", + "payerId": "9k8j7i6h5g4f3e2d1c0b", + "captureId": "qwe123rty456uio789p", + "refundId": "abcde12345fghij67890", + "refundReason": "Customer requested refund", + "disputeId": "zxcvbnm987poiuytrewq", + }, + "customData": [{"key": "value"}], + "metadata": {"isBuyNow": False}, + "isCustomerDeleted": False, + "isShippingRequired": True, + "hasDownloads": False, + "paymentProcessor": "stripe", + "totals": { + "subtotal": {"unit": "USD", "value": "5892", "string": " 109.05 USD"}, + "extras": [ + { + "type": "tax", + "name": "State Taxes", + "description": "NY Taxes (4.00%)", + "price": {"unit": "USD", "value": "5892", "string": " 4.36 USD"}, + }, + { + "type": "tax", + "name": "City Taxes", + "description": "NEW YORK Taxes (4.88%)", + "price": {"unit": "USD", "value": "5892", "string": " 5.32 USD"}, + }, + { + "type": "shipping", + "name": "Flat", + "description": "", + "price": {"unit": "USD", "value": "5892", "string": " 0.00 USD"}, + }, + ], + "total": {"unit": "USD", "value": "5892", "string": " 118.73 USD"}, + }, + "downloadFiles": [ + { + "id": "5e9a5eba75e0ac242e1b6f64", + "name": "New product guide", + "url": "https://webflow.com/dashboard/download-digital-product?payload=5d93ba5e38c6b0160ab711d3;e7634a;5eb1aac72912ec06f561278c;5e9a5eba75e0ac242e1b6f63:ka2nehxy:4a1ee0a632feaab94294350087215ed89533f2f530903e3b933b638940e921aa", + } + ], + } + expected_types: typing.Any = { + "orderId": None, + "status": None, + "comment": None, + "orderComment": None, + "acceptedOn": "datetime", + "fulfilledOn": "datetime", + "refundedOn": "datetime", + "disputedOn": "datetime", + "disputeUpdatedOn": "datetime", + "disputeLastStatus": None, + "customerPaid": {"unit": None, "value": None, "string": None}, + "netAmount": {"unit": None, "value": None, "string": None}, + "applicationFee": {"unit": None, "value": None, "string": None}, + "allAddresses": ( + "list", + { + 0: { + "type": None, + "japanType": None, + "addressee": None, + "line1": None, + "line2": None, + "city": None, + "state": None, + "country": None, + "postalCode": None, + }, + 1: { + "type": None, + "japanType": None, + "addressee": None, + "line1": None, + "line2": None, + "city": None, + "state": None, + "country": None, + "postalCode": None, + }, + }, + ), + "shippingAddress": { + "type": None, + "japanType": None, + "addressee": None, + "line1": None, + "line2": None, + "city": None, + "state": None, + "country": None, + "postalCode": None, + }, + "billingAddress": { + "type": None, + "japanType": None, + "addressee": None, + "line1": None, + "line2": None, + "city": None, + "state": None, + "country": None, + "postalCode": None, + }, + "shippingProvider": None, + "shippingTracking": None, + "shippingTrackingURL": None, + "customerInfo": {"fullName": None, "email": None}, + "purchasedItems": ( + "list", + { + 0: { + "count": None, + "rowTotal": {"unit": None, "value": None, "string": None}, + "productId": None, + "productName": None, + "productSlug": None, + "variantId": None, + "variantName": None, + "variantSlug": None, + "variantSKU": None, + "variantImage": {"url": None}, + "variantPrice": {"unit": None, "value": None, "string": None}, + "weight": None, + "width": None, + "height": None, + "length": None, + }, + 1: { + "count": None, + "rowTotal": {"unit": None, "value": None, "string": None}, + "productId": None, + "productName": None, + "productSlug": None, + "variantId": None, + "variantName": None, + "variantSlug": None, + "variantSKU": None, + "variantImage": {"url": None}, + "variantPrice": {"unit": None, "value": None, "string": None}, + "weight": None, + "width": None, + "height": None, + "length": None, + }, + }, + ), + "purchasedItemsCount": None, + "stripeDetails": { + "subscriptionId": None, + "paymentMethod": None, + "paymentIntentId": None, + "customerId": None, + "chargeId": None, + "disputeId": None, + "refundId": None, + "refundReason": None, + }, + "stripeCard": {"last4": None, "brand": None, "ownerName": None, "expires": {"year": None, "month": None}}, + "paypalDetails": { + "orderId": None, + "payerId": None, + "captureId": None, + "refundId": None, + "refundReason": None, + "disputeId": None, + }, + "customData": ("list", {0: ("dict", {0: (None, None)})}), + "metadata": {"isBuyNow": None}, + "isCustomerDeleted": None, + "isShippingRequired": None, + "hasDownloads": None, + "paymentProcessor": None, + "totals": { + "subtotal": {"unit": None, "value": None, "string": None}, + "extras": ( + "list", + { + 0: { + "type": None, + "name": None, + "description": None, + "price": {"unit": None, "value": None, "string": None}, + }, + 1: { + "type": None, + "name": None, + "description": None, + "price": {"unit": None, "value": None, "string": None}, + }, + 2: { + "type": None, + "name": None, + "description": None, + "price": {"unit": None, "value": None, "string": None}, + }, + }, + ), + "total": {"unit": None, "value": None, "string": None}, + }, + "downloadFiles": ("list", {0: {"id": None, "name": None, "url": None}}), + } + response = client.orders.update_fulfill(site_id="580e63e98c9a982ac9b8b741", order_id="5e8518516e147040726cc415") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.orders.update_fulfill( + site_id="580e63e98c9a982ac9b8b741", order_id="5e8518516e147040726cc415" + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_update_unfulfill(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "orderId": "fc7-128", + "status": "refunded", + "comment": "Customer requested gift wrapping and a personalized note saying: Happy Birthday, Ford! 🎉 Please ensure the item is packed with extra bubble wrap for safe transit.", + "orderComment": 'Please gift wrap with a personal note saying "Happy Birthday, Ford! 🎉', + "acceptedOn": "2024-03-29T21:29:21Z", + "fulfilledOn": "2024-03-29T21:29:21Z", + "refundedOn": "2024-04-08T18:25:04Z", + "disputedOn": "2024-03-29T21:29:21Z", + "disputeUpdatedOn": "2024-03-29T21:29:21Z", + "disputeLastStatus": "charge_refunded", + "customerPaid": {"unit": "USD", "value": "5892", "string": " 118.73 USD"}, + "netAmount": {"unit": "USD", "value": "5892", "string": " 112.62 USD"}, + "applicationFee": {"unit": "USD", "value": "5892", "string": " 2.37 USD"}, + "allAddresses": [ + { + "type": "billing", + "japanType": "kana", + "addressee": "Arthur Dent", + "line1": "20 W 34th St", + "line2": "Empire State Building", + "city": "New York", + "state": "New York", + "country": "US", + "postalCode": "10118", + }, + { + "type": "shipping", + "japanType": "kana", + "addressee": "Arthur Dent", + "line1": "20 W 34th St", + "line2": "Empire State Building", + "city": "New York", + "state": "New York", + "country": "US", + "postalCode": "10118", + }, + ], + "shippingAddress": { + "type": "shipping", + "japanType": "kanji", + "addressee": "Arthur Dent", + "line1": "20 W 34th St", + "line2": "Empire State Building", + "city": "New York", + "state": "New York", + "country": "US", + "postalCode": "10118", + }, + "billingAddress": { + "type": "billing", + "japanType": "kana", + "addressee": "Arthur Dent", + "line1": "20 W 34th St", + "line2": "Empire State Building", + "city": "New York", + "state": "New York", + "country": "US", + "postalCode": "10118", + }, + "shippingProvider": "Shipping Company, Co.", + "shippingTracking": "tr00000000001", + "shippingTrackingURL": "https://www.shippingcompany.com/tracking/tr00000000001", + "customerInfo": {"fullName": "Arthur Dent", "email": "arthur.dent@example.com"}, + "purchasedItems": [ + { + "count": 1, + "rowTotal": {"unit": "USD", "value": "5892", "string": " 55.61 USD"}, + "productId": "66072fb61b89448912e26791", + "productName": "Luxurious Fresh Ball", + "productSlug": "luxurious-fresh-ball", + "variantId": "66072fb71b89448912e2683f", + "variantName": "Luxurious Fresh Ball Generic: Bronze, Practical: Plastic", + "variantSlug": "luxurious-fresh-ball-generic-bronze-practical-plastic", + "variantSKU": "luxurious-fresh-ball-generic-bronze-practical-plastic", + "variantImage": { + "url": "https://d1otoma47x30pg.cloudfront.net/66072f39417a2a35b2589cc7/66072fb51b89448912e2672c_image14.jpeg" + }, + "variantPrice": {"unit": "USD", "value": "5892", "string": " 55.61 USD"}, + "weight": 11, + "width": 82, + "height": 70, + "length": 9, + }, + { + "count": 1, + "rowTotal": {"unit": "USD", "value": "5892", "string": " 53.44 USD"}, + "productId": "66072fb61b89448912e26799", + "productName": "Recycled Steel Gloves", + "productSlug": "recycled-steel-gloves", + "variantId": "66072fb91b89448912e26ab9", + "variantName": "Recycled Steel Gloves Electronic: Granite, Handcrafted: grey", + "variantSlug": "recycled-steel-gloves-electronic-granite-handcrafted-grey", + "variantSKU": "recycled-steel-gloves-electronic-granite-handcrafted-grey", + "variantImage": { + "url": "https://d1otoma47x30pg.cloudfront.net/66072f39417a2a35b2589cc7/66072fb51b89448912e2671e_image2.jpeg" + }, + "variantPrice": {"unit": "USD", "value": "5892", "string": " 53.44 USD"}, + "weight": 38, + "width": 76, + "height": 85, + "length": 40, + }, + ], + "purchasedItemsCount": 2, + "stripeDetails": { + "subscriptionId": "sub_1J6xwG2eZvKYlo2CXu9Zt0Tn", + "paymentMethod": "pm_1OzmzBJYFi4lcbXWHKNdXU7j", + "paymentIntentId": "pi_3OzmzDJYFi4lcbXW1hTBW6ft", + "customerId": "cus_PpRsNHwWdUoRKR", + "chargeId": "ch_3OzmzDJYFi4lcbXW1ndkkrH2", + "disputeId": "disputeId", + "refundId": "re_3OzmzDJYFi4lcbXW1kFAmlBk", + "refundReason": "fraudulent", + }, + "stripeCard": { + "last4": "4242", + "brand": "Visa", + "ownerName": "Arthur Dent", + "expires": {"year": 2024, "month": 4}, + }, + "paypalDetails": { + "orderId": "1a2b3c4d5e6f7g8h9i0j", + "payerId": "9k8j7i6h5g4f3e2d1c0b", + "captureId": "qwe123rty456uio789p", + "refundId": "abcde12345fghij67890", + "refundReason": "Customer requested refund", + "disputeId": "zxcvbnm987poiuytrewq", + }, + "customData": [{"key": "value"}], + "metadata": {"isBuyNow": False}, + "isCustomerDeleted": False, + "isShippingRequired": True, + "hasDownloads": False, + "paymentProcessor": "stripe", + "totals": { + "subtotal": {"unit": "USD", "value": "5892", "string": " 109.05 USD"}, + "extras": [ + { + "type": "tax", + "name": "State Taxes", + "description": "NY Taxes (4.00%)", + "price": {"unit": "USD", "value": "5892", "string": " 4.36 USD"}, + }, + { + "type": "tax", + "name": "City Taxes", + "description": "NEW YORK Taxes (4.88%)", + "price": {"unit": "USD", "value": "5892", "string": " 5.32 USD"}, + }, + { + "type": "shipping", + "name": "Flat", + "description": "", + "price": {"unit": "USD", "value": "5892", "string": " 0.00 USD"}, + }, + ], + "total": {"unit": "USD", "value": "5892", "string": " 118.73 USD"}, + }, + "downloadFiles": [ + { + "id": "5e9a5eba75e0ac242e1b6f64", + "name": "New product guide", + "url": "https://webflow.com/dashboard/download-digital-product?payload=5d93ba5e38c6b0160ab711d3;e7634a;5eb1aac72912ec06f561278c;5e9a5eba75e0ac242e1b6f63:ka2nehxy:4a1ee0a632feaab94294350087215ed89533f2f530903e3b933b638940e921aa", + } + ], + } + expected_types: typing.Any = { + "orderId": None, + "status": None, + "comment": None, + "orderComment": None, + "acceptedOn": "datetime", + "fulfilledOn": "datetime", + "refundedOn": "datetime", + "disputedOn": "datetime", + "disputeUpdatedOn": "datetime", + "disputeLastStatus": None, + "customerPaid": {"unit": None, "value": None, "string": None}, + "netAmount": {"unit": None, "value": None, "string": None}, + "applicationFee": {"unit": None, "value": None, "string": None}, + "allAddresses": ( + "list", + { + 0: { + "type": None, + "japanType": None, + "addressee": None, + "line1": None, + "line2": None, + "city": None, + "state": None, + "country": None, + "postalCode": None, + }, + 1: { + "type": None, + "japanType": None, + "addressee": None, + "line1": None, + "line2": None, + "city": None, + "state": None, + "country": None, + "postalCode": None, + }, + }, + ), + "shippingAddress": { + "type": None, + "japanType": None, + "addressee": None, + "line1": None, + "line2": None, + "city": None, + "state": None, + "country": None, + "postalCode": None, + }, + "billingAddress": { + "type": None, + "japanType": None, + "addressee": None, + "line1": None, + "line2": None, + "city": None, + "state": None, + "country": None, + "postalCode": None, + }, + "shippingProvider": None, + "shippingTracking": None, + "shippingTrackingURL": None, + "customerInfo": {"fullName": None, "email": None}, + "purchasedItems": ( + "list", + { + 0: { + "count": None, + "rowTotal": {"unit": None, "value": None, "string": None}, + "productId": None, + "productName": None, + "productSlug": None, + "variantId": None, + "variantName": None, + "variantSlug": None, + "variantSKU": None, + "variantImage": {"url": None}, + "variantPrice": {"unit": None, "value": None, "string": None}, + "weight": None, + "width": None, + "height": None, + "length": None, + }, + 1: { + "count": None, + "rowTotal": {"unit": None, "value": None, "string": None}, + "productId": None, + "productName": None, + "productSlug": None, + "variantId": None, + "variantName": None, + "variantSlug": None, + "variantSKU": None, + "variantImage": {"url": None}, + "variantPrice": {"unit": None, "value": None, "string": None}, + "weight": None, + "width": None, + "height": None, + "length": None, + }, + }, + ), + "purchasedItemsCount": None, + "stripeDetails": { + "subscriptionId": None, + "paymentMethod": None, + "paymentIntentId": None, + "customerId": None, + "chargeId": None, + "disputeId": None, + "refundId": None, + "refundReason": None, + }, + "stripeCard": {"last4": None, "brand": None, "ownerName": None, "expires": {"year": None, "month": None}}, + "paypalDetails": { + "orderId": None, + "payerId": None, + "captureId": None, + "refundId": None, + "refundReason": None, + "disputeId": None, + }, + "customData": ("list", {0: ("dict", {0: (None, None)})}), + "metadata": {"isBuyNow": None}, + "isCustomerDeleted": None, + "isShippingRequired": None, + "hasDownloads": None, + "paymentProcessor": None, + "totals": { + "subtotal": {"unit": None, "value": None, "string": None}, + "extras": ( + "list", + { + 0: { + "type": None, + "name": None, + "description": None, + "price": {"unit": None, "value": None, "string": None}, + }, + 1: { + "type": None, + "name": None, + "description": None, + "price": {"unit": None, "value": None, "string": None}, + }, + 2: { + "type": None, + "name": None, + "description": None, + "price": {"unit": None, "value": None, "string": None}, + }, + }, + ), + "total": {"unit": None, "value": None, "string": None}, + }, + "downloadFiles": ("list", {0: {"id": None, "name": None, "url": None}}), + } + response = client.orders.update_unfulfill(site_id="580e63e98c9a982ac9b8b741", order_id="5e8518516e147040726cc415") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.orders.update_unfulfill( + site_id="580e63e98c9a982ac9b8b741", order_id="5e8518516e147040726cc415" + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_refund(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "orderId": "fc7-128", + "status": "refunded", + "comment": "Customer requested gift wrapping and a personalized note saying: Happy Birthday, Ford! 🎉 Please ensure the item is packed with extra bubble wrap for safe transit.", + "orderComment": 'Please gift wrap with a personal note saying "Happy Birthday, Ford! 🎉', + "acceptedOn": "2024-03-29T21:29:21Z", + "fulfilledOn": "2024-03-29T21:29:21Z", + "refundedOn": "2024-04-08T18:25:04Z", + "disputedOn": "2024-03-29T21:29:21Z", + "disputeUpdatedOn": "2024-03-29T21:29:21Z", + "disputeLastStatus": "charge_refunded", + "customerPaid": {"unit": "USD", "value": "5892", "string": " 118.73 USD"}, + "netAmount": {"unit": "USD", "value": "5892", "string": " 112.62 USD"}, + "applicationFee": {"unit": "USD", "value": "5892", "string": " 2.37 USD"}, + "allAddresses": [ + { + "type": "billing", + "japanType": "kana", + "addressee": "Arthur Dent", + "line1": "20 W 34th St", + "line2": "Empire State Building", + "city": "New York", + "state": "New York", + "country": "US", + "postalCode": "10118", + }, + { + "type": "shipping", + "japanType": "kana", + "addressee": "Arthur Dent", + "line1": "20 W 34th St", + "line2": "Empire State Building", + "city": "New York", + "state": "New York", + "country": "US", + "postalCode": "10118", + }, + ], + "shippingAddress": { + "type": "shipping", + "japanType": "kanji", + "addressee": "Arthur Dent", + "line1": "20 W 34th St", + "line2": "Empire State Building", + "city": "New York", + "state": "New York", + "country": "US", + "postalCode": "10118", + }, + "billingAddress": { + "type": "billing", + "japanType": "kana", + "addressee": "Arthur Dent", + "line1": "20 W 34th St", + "line2": "Empire State Building", + "city": "New York", + "state": "New York", + "country": "US", + "postalCode": "10118", + }, + "shippingProvider": "Shipping Company, Co.", + "shippingTracking": "tr00000000001", + "shippingTrackingURL": "https://www.shippingcompany.com/tracking/tr00000000001", + "customerInfo": {"fullName": "Arthur Dent", "email": "arthur.dent@example.com"}, + "purchasedItems": [ + { + "count": 1, + "rowTotal": {"unit": "USD", "value": "5892", "string": " 55.61 USD"}, + "productId": "66072fb61b89448912e26791", + "productName": "Luxurious Fresh Ball", + "productSlug": "luxurious-fresh-ball", + "variantId": "66072fb71b89448912e2683f", + "variantName": "Luxurious Fresh Ball Generic: Bronze, Practical: Plastic", + "variantSlug": "luxurious-fresh-ball-generic-bronze-practical-plastic", + "variantSKU": "luxurious-fresh-ball-generic-bronze-practical-plastic", + "variantImage": { + "url": "https://d1otoma47x30pg.cloudfront.net/66072f39417a2a35b2589cc7/66072fb51b89448912e2672c_image14.jpeg" + }, + "variantPrice": {"unit": "USD", "value": "5892", "string": " 55.61 USD"}, + "weight": 11, + "width": 82, + "height": 70, + "length": 9, + }, + { + "count": 1, + "rowTotal": {"unit": "USD", "value": "5892", "string": " 53.44 USD"}, + "productId": "66072fb61b89448912e26799", + "productName": "Recycled Steel Gloves", + "productSlug": "recycled-steel-gloves", + "variantId": "66072fb91b89448912e26ab9", + "variantName": "Recycled Steel Gloves Electronic: Granite, Handcrafted: grey", + "variantSlug": "recycled-steel-gloves-electronic-granite-handcrafted-grey", + "variantSKU": "recycled-steel-gloves-electronic-granite-handcrafted-grey", + "variantImage": { + "url": "https://d1otoma47x30pg.cloudfront.net/66072f39417a2a35b2589cc7/66072fb51b89448912e2671e_image2.jpeg" + }, + "variantPrice": {"unit": "USD", "value": "5892", "string": " 53.44 USD"}, + "weight": 38, + "width": 76, + "height": 85, + "length": 40, + }, + ], + "purchasedItemsCount": 2, + "stripeDetails": { + "subscriptionId": "sub_1J6xwG2eZvKYlo2CXu9Zt0Tn", + "paymentMethod": "pm_1OzmzBJYFi4lcbXWHKNdXU7j", + "paymentIntentId": "pi_3OzmzDJYFi4lcbXW1hTBW6ft", + "customerId": "cus_PpRsNHwWdUoRKR", + "chargeId": "ch_3OzmzDJYFi4lcbXW1ndkkrH2", + "disputeId": "disputeId", + "refundId": "re_3OzmzDJYFi4lcbXW1kFAmlBk", + "refundReason": "fraudulent", + }, + "stripeCard": { + "last4": "4242", + "brand": "Visa", + "ownerName": "Arthur Dent", + "expires": {"year": 2024, "month": 4}, + }, + "paypalDetails": { + "orderId": "1a2b3c4d5e6f7g8h9i0j", + "payerId": "9k8j7i6h5g4f3e2d1c0b", + "captureId": "qwe123rty456uio789p", + "refundId": "abcde12345fghij67890", + "refundReason": "Customer requested refund", + "disputeId": "zxcvbnm987poiuytrewq", + }, + "customData": [{"key": "value"}], + "metadata": {"isBuyNow": False}, + "isCustomerDeleted": False, + "isShippingRequired": True, + "hasDownloads": False, + "paymentProcessor": "stripe", + "totals": { + "subtotal": {"unit": "USD", "value": "5892", "string": " 109.05 USD"}, + "extras": [ + { + "type": "tax", + "name": "State Taxes", + "description": "NY Taxes (4.00%)", + "price": {"unit": "USD", "value": "5892", "string": " 4.36 USD"}, + }, + { + "type": "tax", + "name": "City Taxes", + "description": "NEW YORK Taxes (4.88%)", + "price": {"unit": "USD", "value": "5892", "string": " 5.32 USD"}, + }, + { + "type": "shipping", + "name": "Flat", + "description": "", + "price": {"unit": "USD", "value": "5892", "string": " 0.00 USD"}, + }, + ], + "total": {"unit": "USD", "value": "5892", "string": " 118.73 USD"}, + }, + "downloadFiles": [ + { + "id": "5e9a5eba75e0ac242e1b6f64", + "name": "New product guide", + "url": "https://webflow.com/dashboard/download-digital-product?payload=5d93ba5e38c6b0160ab711d3;e7634a;5eb1aac72912ec06f561278c;5e9a5eba75e0ac242e1b6f63:ka2nehxy:4a1ee0a632feaab94294350087215ed89533f2f530903e3b933b638940e921aa", + } + ], + } + expected_types: typing.Any = { + "orderId": None, + "status": None, + "comment": None, + "orderComment": None, + "acceptedOn": "datetime", + "fulfilledOn": "datetime", + "refundedOn": "datetime", + "disputedOn": "datetime", + "disputeUpdatedOn": "datetime", + "disputeLastStatus": None, + "customerPaid": {"unit": None, "value": None, "string": None}, + "netAmount": {"unit": None, "value": None, "string": None}, + "applicationFee": {"unit": None, "value": None, "string": None}, + "allAddresses": ( + "list", + { + 0: { + "type": None, + "japanType": None, + "addressee": None, + "line1": None, + "line2": None, + "city": None, + "state": None, + "country": None, + "postalCode": None, + }, + 1: { + "type": None, + "japanType": None, + "addressee": None, + "line1": None, + "line2": None, + "city": None, + "state": None, + "country": None, + "postalCode": None, + }, + }, + ), + "shippingAddress": { + "type": None, + "japanType": None, + "addressee": None, + "line1": None, + "line2": None, + "city": None, + "state": None, + "country": None, + "postalCode": None, + }, + "billingAddress": { + "type": None, + "japanType": None, + "addressee": None, + "line1": None, + "line2": None, + "city": None, + "state": None, + "country": None, + "postalCode": None, + }, + "shippingProvider": None, + "shippingTracking": None, + "shippingTrackingURL": None, + "customerInfo": {"fullName": None, "email": None}, + "purchasedItems": ( + "list", + { + 0: { + "count": None, + "rowTotal": {"unit": None, "value": None, "string": None}, + "productId": None, + "productName": None, + "productSlug": None, + "variantId": None, + "variantName": None, + "variantSlug": None, + "variantSKU": None, + "variantImage": {"url": None}, + "variantPrice": {"unit": None, "value": None, "string": None}, + "weight": None, + "width": None, + "height": None, + "length": None, + }, + 1: { + "count": None, + "rowTotal": {"unit": None, "value": None, "string": None}, + "productId": None, + "productName": None, + "productSlug": None, + "variantId": None, + "variantName": None, + "variantSlug": None, + "variantSKU": None, + "variantImage": {"url": None}, + "variantPrice": {"unit": None, "value": None, "string": None}, + "weight": None, + "width": None, + "height": None, + "length": None, + }, + }, + ), + "purchasedItemsCount": None, + "stripeDetails": { + "subscriptionId": None, + "paymentMethod": None, + "paymentIntentId": None, + "customerId": None, + "chargeId": None, + "disputeId": None, + "refundId": None, + "refundReason": None, + }, + "stripeCard": {"last4": None, "brand": None, "ownerName": None, "expires": {"year": None, "month": None}}, + "paypalDetails": { + "orderId": None, + "payerId": None, + "captureId": None, + "refundId": None, + "refundReason": None, + "disputeId": None, + }, + "customData": ("list", {0: ("dict", {0: (None, None)})}), + "metadata": {"isBuyNow": None}, + "isCustomerDeleted": None, + "isShippingRequired": None, + "hasDownloads": None, + "paymentProcessor": None, + "totals": { + "subtotal": {"unit": None, "value": None, "string": None}, + "extras": ( + "list", + { + 0: { + "type": None, + "name": None, + "description": None, + "price": {"unit": None, "value": None, "string": None}, + }, + 1: { + "type": None, + "name": None, + "description": None, + "price": {"unit": None, "value": None, "string": None}, + }, + 2: { + "type": None, + "name": None, + "description": None, + "price": {"unit": None, "value": None, "string": None}, + }, + }, + ), + "total": {"unit": None, "value": None, "string": None}, + }, + "downloadFiles": ("list", {0: {"id": None, "name": None, "url": None}}), + } + response = client.orders.refund(site_id="580e63e98c9a982ac9b8b741", order_id="5e8518516e147040726cc415") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.orders.refund( + site_id="580e63e98c9a982ac9b8b741", order_id="5e8518516e147040726cc415" + ) + validate_response(async_response, expected_response, expected_types) diff --git a/tests/test_pages.py b/tests/test_pages.py new file mode 100644 index 0000000..83eb254 --- /dev/null +++ b/tests/test_pages.py @@ -0,0 +1,385 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime +import typing + +from webflow import DomWriteNodesItem, PageOpenGraph, PageSeo +from webflow.client import AsyncWebflow, Webflow + +from .utilities import validate_response + + +async def test_list_(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "pages": [ + { + "id": "6596da6045e56dee495bcbba", + "siteId": "6258612d1ee792848f805dcf", + "title": "Guide to the Galaxy", + "slug": "guide-to-the-galaxy", + "parentId": "6419db964a9c435aa3af6251", + "collectionId": "6390c49774a71f12831a08e3", + "createdOn": "2024-03-11T10:42:00Z", + "lastUpdated": "2024-03-11T10:42:42Z", + "archived": False, + "draft": False, + "canBranch": True, + "isBranch": False, + "isMembersOnly": False, + "seo": { + "title": "The Ultimate Hitchhiker's Guide to the Galaxy", + "description": "Everything you need to know about the galaxy, from avoiding Vogon poetry to the importance of towels.", + }, + "openGraph": { + "title": "Explore the Cosmos with The Ultimate Guide", + "titleCopied": False, + "description": "Dive deep into the mysteries of the universe with your guide to everything galactic.", + "descriptionCopied": False, + }, + "localeId": "653fd9af6a07fc9cfd7a5e57", + "publishedPath": "/en-us/guide-to-the-galaxy", + }, + { + "id": "6596da6045e56dee495bcbad", + "siteId": "6258612d1ee792848f805dcf", + "title": "Towel Day Celebrations", + "slug": "towel-day", + "parentId": "6419db964a9c435aa3af6251", + "collectionId": "6390c49774a71f12831a08e3", + "createdOn": "2024-05-25T09:00:00Z", + "lastUpdated": "2024-05-25T09:42:00Z", + "archived": False, + "draft": False, + "canBranch": True, + "isBranch": False, + "isMembersOnly": False, + "seo": { + "title": "Celebrate Towel Day - The Hitchhiker's Guide to the Galaxy", + "description": "A guide to celebrating Towel Day, in honor of the most massively useful thing an interstellar hitchhiker can have.", + }, + "openGraph": { + "title": "Towel Day - Don't Panic", + "titleCopied": False, + "description": "Join the galaxy in celebrating Towel Day, the day dedicated to carrying towels everywhere in memory of Douglas Adams.", + "descriptionCopied": False, + }, + "localeId": "653fd9af6a07fc9cfd7a5e57", + "publishedPath": "/en-us/towel-day", + }, + ], + "pagination": {"limit": 20, "offset": 0, "total": 2}, + } + expected_types: typing.Any = { + "pages": ( + "list", + { + 0: { + "id": None, + "siteId": None, + "title": None, + "slug": None, + "parentId": None, + "collectionId": None, + "createdOn": "datetime", + "lastUpdated": "datetime", + "archived": None, + "draft": None, + "canBranch": None, + "isBranch": None, + "isMembersOnly": None, + "seo": {"title": None, "description": None}, + "openGraph": {"title": None, "titleCopied": None, "description": None, "descriptionCopied": None}, + "localeId": None, + "publishedPath": None, + }, + 1: { + "id": None, + "siteId": None, + "title": None, + "slug": None, + "parentId": None, + "collectionId": None, + "createdOn": "datetime", + "lastUpdated": "datetime", + "archived": None, + "draft": None, + "canBranch": None, + "isBranch": None, + "isMembersOnly": None, + "seo": {"title": None, "description": None}, + "openGraph": {"title": None, "titleCopied": None, "description": None, "descriptionCopied": None}, + "localeId": None, + "publishedPath": None, + }, + }, + ), + "pagination": {"limit": None, "offset": None, "total": None}, + } + response = client.pages.list(site_id="580e63e98c9a982ac9b8b741", locale_id="65427cf400e02b306eaa04a0") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.pages.list( + site_id="580e63e98c9a982ac9b8b741", locale_id="65427cf400e02b306eaa04a0" + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_get_metadata(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "id": "6596da6045e56dee495bcbba", + "siteId": "6258612d1ee792848f805dcf", + "title": "Guide to the Galaxy", + "slug": "guide-to-the-galaxy", + "parentId": "6419db964a9c435aa3af6251", + "collectionId": "6390c49774a71f12831a08e3", + "createdOn": "2024-03-11T10:42:00Z", + "lastUpdated": "2024-03-11T10:42:42Z", + "archived": False, + "draft": False, + "canBranch": True, + "isBranch": False, + "isMembersOnly": False, + "seo": { + "title": "The Ultimate Hitchhiker's Guide to the Galaxy", + "description": "Everything you need to know about the galaxy, from avoiding Vogon poetry to the importance of towels.", + }, + "openGraph": { + "title": "Explore the Cosmos with The Ultimate Guide", + "titleCopied": False, + "description": "Dive deep into the mysteries of the universe with your guide to everything galactic.", + "descriptionCopied": False, + }, + "localeId": "653fd9af6a07fc9cfd7a5e57", + "publishedPath": "/en-us/guide-to-the-galaxy", + } + expected_types: typing.Any = { + "id": None, + "siteId": None, + "title": None, + "slug": None, + "parentId": None, + "collectionId": None, + "createdOn": "datetime", + "lastUpdated": "datetime", + "archived": None, + "draft": None, + "canBranch": None, + "isBranch": None, + "isMembersOnly": None, + "seo": {"title": None, "description": None}, + "openGraph": {"title": None, "titleCopied": None, "description": None, "descriptionCopied": None}, + "localeId": None, + "publishedPath": None, + } + response = client.pages.get_metadata(page_id="63c720f9347c2139b248e552", locale_id="65427cf400e02b306eaa04a0") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.pages.get_metadata( + page_id="63c720f9347c2139b248e552", locale_id="65427cf400e02b306eaa04a0" + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_update_page_settings(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "id": "6596da6045e56dee495bcbba", + "siteId": "6258612d1ee792848f805dcf", + "title": "Guide to the Galaxy", + "slug": "guide-to-the-galaxy", + "parentId": "6419db964a9c435aa3af6251", + "collectionId": "6390c49774a71f12831a08e3", + "createdOn": "2024-03-11T10:42:00Z", + "lastUpdated": "2024-03-11T10:42:42Z", + "archived": False, + "draft": False, + "canBranch": True, + "isBranch": False, + "isMembersOnly": False, + "seo": { + "title": "The Ultimate Hitchhiker's Guide to the Galaxy", + "description": "Everything you need to know about the galaxy, from avoiding Vogon poetry to the importance of towels.", + }, + "openGraph": { + "title": "Explore the Cosmos with The Ultimate Guide", + "titleCopied": False, + "description": "Dive deep into the mysteries of the universe with your guide to everything galactic.", + "descriptionCopied": False, + }, + "localeId": "653fd9af6a07fc9cfd7a5e57", + "publishedPath": "/en-us/guide-to-the-galaxy", + } + expected_types: typing.Any = { + "id": None, + "siteId": None, + "title": None, + "slug": None, + "parentId": None, + "collectionId": None, + "createdOn": "datetime", + "lastUpdated": "datetime", + "archived": None, + "draft": None, + "canBranch": None, + "isBranch": None, + "isMembersOnly": None, + "seo": {"title": None, "description": None}, + "openGraph": {"title": None, "titleCopied": None, "description": None, "descriptionCopied": None}, + "localeId": None, + "publishedPath": None, + } + response = client.pages.update_page_settings( + page_id="63c720f9347c2139b248e552", + locale_id="65427cf400e02b306eaa04a0", + id="6596da6045e56dee495bcbba", + site_id="6258612d1ee792848f805dcf", + title="Guide to the Galaxy", + slug="guide-to-the-galaxy", + created_on=datetime.datetime.fromisoformat("2024-03-11 10:42:00+00:00"), + last_updated=datetime.datetime.fromisoformat("2024-03-11 10:42:42+00:00"), + archived=False, + draft=False, + can_branch=True, + is_branch=False, + seo=PageSeo( + title="The Ultimate Hitchhiker's Guide to the Galaxy", + description="Everything you need to know about the galaxy, from avoiding Vogon poetry to the importance of towels.", + ), + open_graph=PageOpenGraph( + title="Explore the Cosmos with The Ultimate Guide", + title_copied=False, + description="Dive deep into the mysteries of the universe with your guide to everything galactic.", + description_copied=False, + ), + page_locale_id="653fd9af6a07fc9cfd7a5e57", + published_path="/en-us/guide-to-the-galaxy", + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.pages.update_page_settings( + page_id="63c720f9347c2139b248e552", + locale_id="65427cf400e02b306eaa04a0", + id="6596da6045e56dee495bcbba", + site_id="6258612d1ee792848f805dcf", + title="Guide to the Galaxy", + slug="guide-to-the-galaxy", + created_on=datetime.datetime.fromisoformat("2024-03-11 10:42:00+00:00"), + last_updated=datetime.datetime.fromisoformat("2024-03-11 10:42:42+00:00"), + archived=False, + draft=False, + can_branch=True, + is_branch=False, + seo=PageSeo( + title="The Ultimate Hitchhiker's Guide to the Galaxy", + description="Everything you need to know about the galaxy, from avoiding Vogon poetry to the importance of towels.", + ), + open_graph=PageOpenGraph( + title="Explore the Cosmos with The Ultimate Guide", + title_copied=False, + description="Dive deep into the mysteries of the universe with your guide to everything galactic.", + description_copied=False, + ), + page_locale_id="653fd9af6a07fc9cfd7a5e57", + published_path="/en-us/guide-to-the-galaxy", + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_get_content(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "pageId": "658205daa3e8206a523b5ad4", + "nodes": [ + { + "id": "a245c12d-995b-55ee-5ec7-aa36a6cad623", + "type": "text", + "text": { + "html": "

The Hitchhiker's Guide to the Galaxy

", + "text": "The Hitchhiker's Guide to the Galaxy", + }, + "attributes": {"key": "value"}, + }, + { + "id": "a245c12d-995b-55ee-5ec7-aa36a6cad627", + "type": "text", + "text": {"html": "

Don't Panic!

Always know where your towel is.

"}, + "attributes": {"key": "value"}, + }, + { + "id": "a245c12d-995b-55ee-5ec7-aa36a6cad629", + "type": "image", + "image": {"alt": "Marvin, the Paranoid Android", "assetId": "659595234426a9fcbad57043"}, + "attributes": {"key": "value"}, + }, + ], + "pagination": {"limit": 3, "offset": 0, "total": 3}, + } + expected_types: typing.Any = { + "pageId": None, + "nodes": ( + "list", + { + 0: { + "id": None, + "type": None, + "text": {"html": None, "text": None}, + "attributes": ("dict", {0: (None, None)}), + }, + 1: {"id": None, "type": None, "text": {"html": None}, "attributes": ("dict", {0: (None, None)})}, + 2: { + "id": None, + "type": None, + "image": {"alt": None, "assetId": None}, + "attributes": ("dict", {0: (None, None)}), + }, + }, + ), + "pagination": {"limit": None, "offset": None, "total": None}, + } + response = client.pages.get_content(page_id="63c720f9347c2139b248e552", locale_id="65427cf400e02b306eaa04a0") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.pages.get_content( + page_id="63c720f9347c2139b248e552", locale_id="65427cf400e02b306eaa04a0" + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_update_static_content(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = {"errors": ["errors"]} + expected_types: typing.Any = {"errors": ("list", {0: None})} + response = client.pages.update_static_content( + page_id="63c720f9347c2139b248e552", + locale_id="65427cf400e02b306eaa04a0", + nodes=[ + DomWriteNodesItem( + node_id="a245c12d-995b-55ee-5ec7-aa36a6cad623", text="

The Hitchhiker’s Guide to the Galaxy

" + ), + DomWriteNodesItem( + node_id="a245c12d-995b-55ee-5ec7-aa36a6cad627", + text="

Don’t Panic!

Always know where your towel is.

", + ), + DomWriteNodesItem( + node_id="a245c12d-995b-55ee-5ec7-aa36a6cad629", + text='Marvin, the Paranoid Android', + ), + ], + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.pages.update_static_content( + page_id="63c720f9347c2139b248e552", + locale_id="65427cf400e02b306eaa04a0", + nodes=[ + DomWriteNodesItem( + node_id="a245c12d-995b-55ee-5ec7-aa36a6cad623", text="

The Hitchhiker’s Guide to the Galaxy

" + ), + DomWriteNodesItem( + node_id="a245c12d-995b-55ee-5ec7-aa36a6cad627", + text="

Don’t Panic!

Always know where your towel is.

", + ), + DomWriteNodesItem( + node_id="a245c12d-995b-55ee-5ec7-aa36a6cad629", + text='Marvin, the Paranoid Android', + ), + ], + ) + validate_response(async_response, expected_response, expected_types) diff --git a/tests/test_products.py b/tests/test_products.py new file mode 100644 index 0000000..4c13431 --- /dev/null +++ b/tests/test_products.py @@ -0,0 +1,466 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from webflow import Sku +from webflow.client import AsyncWebflow, Webflow + +from .utilities import validate_response + + +async def test_list_(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "items": [ + { + "product": { + "id": "660eb7a486d1d6e0412292d7", + "cmsLocaleId": "653ad57de882f528b32e810e", + "lastPublished": "2024-04-04T14:24:19Z", + "lastUpdated": "2024-04-04T14:30:19Z", + "createdOn": "2024-04-04T14:22:28Z", + "isArchived": False, + "isDraft": False, + "fieldData": { + "name": "T-Shirt", + "slug": "t-shirt", + "description": "A plain cotton t-shirt.", + "shippable": True, + "sku-properties": [ + { + "id": "Color", + "name": "Color", + "enum": [{"id": "id", "name": "Royal Blue", "slug": "royal-blue"}], + } + ], + }, + }, + "skus": [ + { + "id": "580e63fc8c9a982ac9b8b745", + "cmsLocaleId": "653ad57de882f528b32e810e", + "lastPublished": "2023-03-17T18:47:35Z", + "lastUpdated": "2023-03-17T18:47:35Z", + "createdOn": "2023-03-17T18:47:35Z", + "fieldData": { + "sku-values": {"ff42fee0113744f693a764e3431a9cc2": "64a74715c456e36762fc39a1"}, + "name": "Blue T-shirt", + "slug": "t-shirt-blue", + "price": {"value": 100, "unit": "USD"}, + "quantity": 10, + }, + } + ], + } + ], + "pagination": {"limit": 100, "offset": 0, "total": 100}, + } + expected_types: typing.Any = { + "items": ( + "list", + { + 0: { + "product": { + "id": None, + "cmsLocaleId": None, + "lastPublished": "datetime", + "lastUpdated": "datetime", + "createdOn": "datetime", + "isArchived": None, + "isDraft": None, + "fieldData": { + "name": None, + "slug": None, + "description": None, + "shippable": None, + "sku-properties": ( + "list", + { + 0: { + "id": None, + "name": None, + "enum": ("list", {0: {"id": None, "name": None, "slug": None}}), + } + }, + ), + }, + }, + "skus": ( + "list", + { + 0: { + "id": None, + "cmsLocaleId": None, + "lastPublished": "datetime", + "lastUpdated": "datetime", + "createdOn": "datetime", + "fieldData": { + "sku-values": ("dict", {0: (None, None)}), + "name": None, + "slug": None, + "price": {"value": None, "unit": None}, + "quantity": None, + }, + } + }, + ), + } + }, + ), + "pagination": {"limit": None, "offset": None, "total": None}, + } + response = client.products.list(site_id="580e63e98c9a982ac9b8b741") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.products.list(site_id="580e63e98c9a982ac9b8b741") + validate_response(async_response, expected_response, expected_types) + + +async def test_create(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "product": { + "id": "660eb7a486d1d6e0412292d7", + "cmsLocaleId": "653ad57de882f528b32e810e", + "lastPublished": "2024-04-04T14:24:19Z", + "lastUpdated": "2024-04-04T14:30:19Z", + "createdOn": "2024-04-04T14:22:28Z", + "isArchived": False, + "isDraft": False, + "fieldData": { + "name": "T-Shirt", + "slug": "t-shirt", + "description": "A plain cotton t-shirt.", + "shippable": True, + "sku-properties": [ + {"id": "Color", "name": "Color", "enum": [{"id": "id", "name": "Royal Blue", "slug": "royal-blue"}]} + ], + "categories": ["categories"], + "tax-category": "standard-taxable", + "default-sku": "default-sku", + "ec-product-type": "ff42fee0113744f693a764e3431a9cc2", + }, + }, + "skus": [ + { + "id": "580e63fc8c9a982ac9b8b745", + "cmsLocaleId": "653ad57de882f528b32e810e", + "lastPublished": "2023-03-17T18:47:35Z", + "lastUpdated": "2023-03-17T18:47:35Z", + "createdOn": "2023-03-17T18:47:35Z", + "fieldData": { + "sku-values": {"ff42fee0113744f693a764e3431a9cc2": "64a74715c456e36762fc39a1"}, + "name": "Blue T-shirt", + "slug": "t-shirt-blue", + "price": {"value": 100, "unit": "USD"}, + "quantity": 10, + }, + } + ], + } + expected_types: typing.Any = { + "product": { + "id": None, + "cmsLocaleId": None, + "lastPublished": "datetime", + "lastUpdated": "datetime", + "createdOn": "datetime", + "isArchived": None, + "isDraft": None, + "fieldData": { + "name": None, + "slug": None, + "description": None, + "shippable": None, + "sku-properties": ( + "list", + {0: {"id": None, "name": None, "enum": ("list", {0: {"id": None, "name": None, "slug": None}})}}, + ), + "categories": ("list", {0: None}), + "tax-category": None, + "default-sku": None, + "ec-product-type": None, + }, + }, + "skus": ( + "list", + { + 0: { + "id": None, + "cmsLocaleId": None, + "lastPublished": "datetime", + "lastUpdated": "datetime", + "createdOn": "datetime", + "fieldData": { + "sku-values": ("dict", {0: (None, None)}), + "name": None, + "slug": None, + "price": {"value": None, "unit": None}, + "quantity": None, + }, + } + }, + ), + } + response = client.products.create(site_id="580e63e98c9a982ac9b8b741") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.products.create(site_id="580e63e98c9a982ac9b8b741") + validate_response(async_response, expected_response, expected_types) + + +async def test_get(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "product": { + "id": "660eb7a486d1d6e0412292d7", + "cmsLocaleId": "653ad57de882f528b32e810e", + "lastPublished": "2024-04-04T14:24:19Z", + "lastUpdated": "2024-04-04T14:30:19Z", + "createdOn": "2024-04-04T14:22:28Z", + "isArchived": False, + "isDraft": False, + "fieldData": { + "name": "T-Shirt", + "slug": "t-shirt", + "description": "A plain cotton t-shirt.", + "shippable": True, + "sku-properties": [ + {"id": "Color", "name": "Color", "enum": [{"id": "id", "name": "Royal Blue", "slug": "royal-blue"}]} + ], + "categories": ["categories"], + "tax-category": "standard-taxable", + "default-sku": "default-sku", + "ec-product-type": "ff42fee0113744f693a764e3431a9cc2", + }, + }, + "skus": [ + { + "id": "580e63fc8c9a982ac9b8b745", + "cmsLocaleId": "653ad57de882f528b32e810e", + "lastPublished": "2023-03-17T18:47:35Z", + "lastUpdated": "2023-03-17T18:47:35Z", + "createdOn": "2023-03-17T18:47:35Z", + "fieldData": { + "sku-values": {"ff42fee0113744f693a764e3431a9cc2": "64a74715c456e36762fc39a1"}, + "name": "Blue T-shirt", + "slug": "t-shirt-blue", + "price": {"value": 100, "unit": "USD"}, + "quantity": 10, + }, + } + ], + } + expected_types: typing.Any = { + "product": { + "id": None, + "cmsLocaleId": None, + "lastPublished": "datetime", + "lastUpdated": "datetime", + "createdOn": "datetime", + "isArchived": None, + "isDraft": None, + "fieldData": { + "name": None, + "slug": None, + "description": None, + "shippable": None, + "sku-properties": ( + "list", + {0: {"id": None, "name": None, "enum": ("list", {0: {"id": None, "name": None, "slug": None}})}}, + ), + "categories": ("list", {0: None}), + "tax-category": None, + "default-sku": None, + "ec-product-type": None, + }, + }, + "skus": ( + "list", + { + 0: { + "id": None, + "cmsLocaleId": None, + "lastPublished": "datetime", + "lastUpdated": "datetime", + "createdOn": "datetime", + "fieldData": { + "sku-values": ("dict", {0: (None, None)}), + "name": None, + "slug": None, + "price": {"value": None, "unit": None}, + "quantity": None, + }, + } + }, + ), + } + response = client.products.get(site_id="580e63e98c9a982ac9b8b741", product_id="580e63fc8c9a982ac9b8b745") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.products.get( + site_id="580e63e98c9a982ac9b8b741", product_id="580e63fc8c9a982ac9b8b745" + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_update(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "id": "660eb7a486d1d6e0412292d7", + "cmsLocaleId": "653ad57de882f528b32e810e", + "lastPublished": "2024-04-04T14:24:19Z", + "lastUpdated": "2024-04-04T14:30:19Z", + "createdOn": "2024-04-04T14:22:28Z", + "isArchived": False, + "isDraft": False, + "fieldData": { + "name": "T-Shirt", + "slug": "t-shirt", + "description": "A plain cotton t-shirt.", + "shippable": True, + "sku-properties": [ + {"id": "Color", "name": "Color", "enum": [{"id": "id", "name": "Royal Blue", "slug": "royal-blue"}]} + ], + "categories": ["categories"], + "tax-category": "standard-taxable", + "default-sku": "default-sku", + "ec-product-type": "ff42fee0113744f693a764e3431a9cc2", + }, + } + expected_types: typing.Any = { + "id": None, + "cmsLocaleId": None, + "lastPublished": "datetime", + "lastUpdated": "datetime", + "createdOn": "datetime", + "isArchived": None, + "isDraft": None, + "fieldData": { + "name": None, + "slug": None, + "description": None, + "shippable": None, + "sku-properties": ( + "list", + {0: {"id": None, "name": None, "enum": ("list", {0: {"id": None, "name": None, "slug": None}})}}, + ), + "categories": ("list", {0: None}), + "tax-category": None, + "default-sku": None, + "ec-product-type": None, + }, + } + response = client.products.update(site_id="580e63e98c9a982ac9b8b741", product_id="580e63fc8c9a982ac9b8b745") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.products.update( + site_id="580e63e98c9a982ac9b8b741", product_id="580e63fc8c9a982ac9b8b745" + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_create_sku(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "skus": [ + { + "id": "580e63fc8c9a982ac9b8b745", + "cmsLocaleId": "653ad57de882f528b32e810e", + "lastPublished": "2023-03-17T18:47:35Z", + "lastUpdated": "2023-03-17T18:47:35Z", + "createdOn": "2023-03-17T18:47:35Z", + "fieldData": { + "sku-values": {"ff42fee0113744f693a764e3431a9cc2": "64a74715c456e36762fc39a1"}, + "name": "Blue T-shirt", + "slug": "t-shirt-blue", + "price": {"value": 100, "unit": "USD"}, + "quantity": 10, + }, + } + ] + } + expected_types: typing.Any = { + "skus": ( + "list", + { + 0: { + "id": None, + "cmsLocaleId": None, + "lastPublished": "datetime", + "lastUpdated": "datetime", + "createdOn": "datetime", + "fieldData": { + "sku-values": ("dict", {0: (None, None)}), + "name": None, + "slug": None, + "price": {"value": None, "unit": None}, + "quantity": None, + }, + } + }, + ) + } + response = client.products.create_sku( + site_id="580e63e98c9a982ac9b8b741", product_id="580e63fc8c9a982ac9b8b745", skus=[Sku()] + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.products.create_sku( + site_id="580e63e98c9a982ac9b8b741", product_id="580e63fc8c9a982ac9b8b745", skus=[Sku()] + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_update_sku(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "id": "580e63fc8c9a982ac9b8b745", + "cmsLocaleId": "653ad57de882f528b32e810e", + "lastPublished": "2023-03-17T18:47:35Z", + "lastUpdated": "2023-03-17T18:47:35Z", + "createdOn": "2023-03-17T18:47:35Z", + "fieldData": { + "sku-values": {"ff42fee0113744f693a764e3431a9cc2": "64a74715c456e36762fc39a1"}, + "name": "Blue T-shirt", + "slug": "t-shirt-blue", + "price": {"value": 100, "unit": "USD"}, + "compare-at-price": {"value": 100, "unit": "USD"}, + "ec-sku-billing-method": "one-time", + "ec-sku-subscription-plan": {"interval": "day", "frequency": 1, "trial": 7, "plans": [{}]}, + "track-inventory": True, + "quantity": 10, + }, + } + expected_types: typing.Any = { + "id": None, + "cmsLocaleId": None, + "lastPublished": "datetime", + "lastUpdated": "datetime", + "createdOn": "datetime", + "fieldData": { + "sku-values": ("dict", {0: (None, None)}), + "name": None, + "slug": None, + "price": {"value": None, "unit": None}, + "compare-at-price": {"value": None, "unit": None}, + "ec-sku-billing-method": None, + "ec-sku-subscription-plan": { + "interval": None, + "frequency": None, + "trial": None, + "plans": ("list", {0: {}}), + }, + "track-inventory": None, + "quantity": None, + }, + } + response = client.products.update_sku( + site_id="580e63e98c9a982ac9b8b741", + product_id="580e63fc8c9a982ac9b8b745", + sku_id="5e8518516e147040726cc415", + sku=Sku(), + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.products.update_sku( + site_id="580e63e98c9a982ac9b8b741", + product_id="580e63fc8c9a982ac9b8b745", + sku_id="5e8518516e147040726cc415", + sku=Sku(), + ) + validate_response(async_response, expected_response, expected_types) diff --git a/tests/test_scripts.py b/tests/test_scripts.py new file mode 100644 index 0000000..e4423e9 --- /dev/null +++ b/tests/test_scripts.py @@ -0,0 +1,158 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from webflow.client import AsyncWebflow, Webflow + +from .utilities import validate_response + + +async def test_list_(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "registeredScripts": [ + { + "id": "alert", + "canCopy": False, + "displayName": "Alert", + "hostedLocation": "https://cdn.webflow.io/.../alert-0.0.1.js", + "integrityHash": "integrityHash", + "createdOn": "2022-10-26T00:28:54.191Z", + "lastUpdated": "lastUpdated", + "version": "0.0.1", + }, + { + "id": "alert", + "canCopy": False, + "displayName": "Alert", + "hostedLocation": "https://cdn.webflow.io/.../alert-0.0.2.js", + "integrityHash": "integrityHash", + "createdOn": "2022-10-26T00:28:54.191Z", + "lastUpdated": "lastUpdated", + "version": "0.0.2", + }, + { + "id": "cms_slider", + "canCopy": True, + "displayName": "CMS Slider", + "hostedLocation": "https://cdn.jsdelivr.net/.../cms_slider.js", + "integrityHash": "sha384-J+YlJ8v0gpaRoKH7SbFbEmxOZlAxLiwNjfSsBhDooGa5roXlPPpXbEevck4J7YZ+", + "createdOn": "2022-10-26T00:28:54.191Z", + "lastUpdated": "lastUpdated", + "version": "1.0.0", + }, + ] + } + expected_types: typing.Any = { + "registeredScripts": ( + "list", + { + 0: { + "id": None, + "canCopy": None, + "displayName": None, + "hostedLocation": None, + "integrityHash": None, + "createdOn": None, + "lastUpdated": None, + "version": None, + }, + 1: { + "id": None, + "canCopy": None, + "displayName": None, + "hostedLocation": None, + "integrityHash": None, + "createdOn": None, + "lastUpdated": None, + "version": None, + }, + 2: { + "id": None, + "canCopy": None, + "displayName": None, + "hostedLocation": None, + "integrityHash": None, + "createdOn": None, + "lastUpdated": None, + "version": None, + }, + }, + ) + } + response = client.scripts.list(site_id="580e63e98c9a982ac9b8b741") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.scripts.list(site_id="580e63e98c9a982ac9b8b741") + validate_response(async_response, expected_response, expected_types) + + +async def test_register_hosted(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "id": "cms_slider", + "canCopy": True, + "displayName": "CMS Slider", + "hostedLocation": "https://cdn.jsdelivr.net/.../cmsslider.js", + "integrityHash": "sha384-J+YlJ8v0gpaRoKH7SbFbEmxOZlAxLiwNjfSsBhDooGa5roXlPPpXbEevck4J7YZ+", + "createdOn": "2022-10-26T00:28:54.191Z", + "lastUpdated": "lastUpdated", + "version": "1.0.0", + } + expected_types: typing.Any = { + "id": None, + "canCopy": None, + "displayName": None, + "hostedLocation": None, + "integrityHash": None, + "createdOn": None, + "lastUpdated": None, + "version": None, + } + response = client.scripts.register_hosted( + site_id="580e63e98c9a982ac9b8b741", + hosted_location="hostedLocation", + integrity_hash="integrityHash", + version="version", + display_name="displayName", + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.scripts.register_hosted( + site_id="580e63e98c9a982ac9b8b741", + hosted_location="hostedLocation", + integrity_hash="integrityHash", + version="version", + display_name="displayName", + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_register_inline(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "id": "alert", + "canCopy": False, + "displayName": "Alert", + "hostedLocation": "https://uploads-ssl.webflow.com/6258612d1ee792848f805dcf%2F64b6c769ff52ba6c3d904a91%2F660d6e15b3d1696f2d2b1447%2Falert-0.0.1.js", + "integrityHash": "integrityHash", + "createdOn": "2022-10-26T00:28:54.191Z", + "lastUpdated": "lastUpdated", + "version": "0.0.1", + } + expected_types: typing.Any = { + "id": None, + "canCopy": None, + "displayName": None, + "hostedLocation": None, + "integrityHash": None, + "createdOn": None, + "lastUpdated": None, + "version": None, + } + response = client.scripts.register_inline( + site_id="580e63e98c9a982ac9b8b741", source_code="alert('hello world');", version="0.0.1", display_name="Alert" + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.scripts.register_inline( + site_id="580e63e98c9a982ac9b8b741", source_code="alert('hello world');", version="0.0.1", display_name="Alert" + ) + validate_response(async_response, expected_response, expected_types) diff --git a/tests/test_sites.py b/tests/test_sites.py new file mode 100644 index 0000000..3f17225 --- /dev/null +++ b/tests/test_sites.py @@ -0,0 +1,398 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from webflow.client import AsyncWebflow, Webflow + +from .utilities import validate_response + + +async def test_list_(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "sites": [ + { + "id": "42e63e98c9a982ac9b8b741", + "workspaceId": "42e63fc8c9a982ac9b8b744", + "createdOn": "1979-10-12T12:00:00Z", + "displayName": "Heart of Gold Spaceship", + "shortName": "heart-of-gold", + "lastPublished": "2023-04-02T12:42:00Z", + "lastUpdated": "2016-10-24T19:43:17Z", + "previewUrl": "https://d1otoma47x30pg.cloudfront.net/42e63e98c9a982ac9b8b741/197910121200.png", + "timeZone": "DeepSpace/InfiniteImprobability", + "parentFolderId": "1as2d3f4g5h6j7k8l9z0x1c2v3b4n5m6", + "customDomains": [{"id": "589a331aa51e760df7ccb89e", "url": "heartofgold.galaxy"}], + "locales": { + "primary": { + "id": "653fd9af6a07fc9cfd7a5e57", + "cmsLocaleId": "653ad57de882f528b32e810e", + "enabled": True, + "displayName": "English - Heart of Gold Standard", + "redirect": False, + "subdirectory": "/en", + "tag": "The Ultimate Answer", + }, + "secondary": [ + { + "id": "653fd9af6a07fc9cfd7a5e58", + "cmsLocaleId": "653ad57de882f528b32e810g", + "enabled": True, + "displayName": "Betelgeusian - Vogon Liaison", + "redirect": True, + "subdirectory": "/bet", + "tag": "Vogon", + }, + { + "id": "653fd9af6a07fc9cfd7a5e59", + "cmsLocaleId": "653ad57de882f528b32e810h", + "enabled": False, + "displayName": "Magrathean - Custom Planet Designs", + "redirect": True, + "subdirectory": "/mg", + "tag": "Magrathean", + }, + ], + }, + "dataCollectionEnabled": True, + "dataCollectionType": "always", + }, + { + "id": "42e63e98c9a982ac9b8b742", + "workspaceId": "42e63fc8c9a982ac9b8b745", + "createdOn": "1981-10-12T12:00:00Z", + "displayName": "Marvin's Personal Blog", + "shortName": "paranoid-android", + "lastPublished": "2023-04-02T12:45:00Z", + "lastUpdated": "2016-10-24T19:43:17Z", + "previewUrl": "https://d1otoma47x30pg.cloudfront.net/42e63e98c9a982ac9b8b742/198110121200.png", + "timeZone": "DeepSpace/Depression", + "parentFolderId": "1as2d3f4g5h6j7k8l9z0x1c2v3b4n5m6", + "customDomains": [{"id": "589a331aa51e760df7ccb89f", "url": "marvin.blog"}], + "locales": { + "primary": { + "id": "653fd9af6a07fc9cfd7a5e57", + "cmsLocaleId": "653ad57de882f528b32e810e", + "enabled": True, + "displayName": "English - Marvin's Musings", + "redirect": False, + "subdirectory": "/en", + "tag": "English", + }, + "secondary": [ + { + "id": "653fd9af6a07fc9cfd7a5e56", + "cmsLocaleId": "653ad57de882f528b32e810f", + "enabled": True, + "displayName": "Squornshellous - Mattress Speak", + "redirect": True, + "subdirectory": "/sr", + "tag": "Squornshellous", + } + ], + }, + "dataCollectionEnabled": True, + "dataCollectionType": "always", + }, + { + "id": "42e63e98c9a982ac9b8b743", + "workspaceId": "42e63fc8c9a982ac9b8b746", + "createdOn": "1982-10-12T12:00:00Z", + "displayName": "Vogon Poetry Archive", + "shortName": "vogon-poetry", + "lastPublished": "2023-04-02T12:50:00Z", + "lastUpdated": "2016-10-24T19:43:17Z", + "previewUrl": "https://d1otoma47x30pg.cloudfront.net/42e63e98c9a982ac9b8b743/198210121200.png", + "timeZone": "Vogsphere/PoetryHall", + "parentFolderId": "1as2d3f4g5h6j7k8l9z0x1c2v3b4n5m6", + "customDomains": [{"id": "589a331aa51e760df7ccb8a0", "url": "vogonpoetry.galaxy"}], + "locales": { + "primary": { + "id": "653fd9af6a07fc9cfd7a5e55", + "cmsLocaleId": "653ad57de882f528b32e810d", + "enabled": True, + "displayName": "English - Vogon Verse", + "redirect": False, + "subdirectory": "/en", + "tag": "Third Worst Poetry", + }, + "secondary": [ + { + "id": "653fd9af6a07fc9cfd7a5e54", + "cmsLocaleId": "653ad57de882f528b32e810c", + "enabled": True, + "displayName": "Galactic - Universal Language", + "redirect": True, + "subdirectory": "/gl", + "tag": "Pan-Galactic Gargle Blaster", + } + ], + }, + "dataCollectionEnabled": True, + "dataCollectionType": "always", + }, + ] + } + expected_types: typing.Any = { + "sites": ( + "list", + { + 0: { + "id": None, + "workspaceId": None, + "createdOn": "datetime", + "displayName": None, + "shortName": None, + "lastPublished": "datetime", + "lastUpdated": "datetime", + "previewUrl": None, + "timeZone": None, + "parentFolderId": None, + "customDomains": ("list", {0: {"id": None, "url": None}}), + "locales": { + "primary": { + "id": None, + "cmsLocaleId": None, + "enabled": None, + "displayName": None, + "redirect": None, + "subdirectory": None, + "tag": None, + }, + "secondary": ( + "list", + { + 0: { + "id": None, + "cmsLocaleId": None, + "enabled": None, + "displayName": None, + "redirect": None, + "subdirectory": None, + "tag": None, + }, + 1: { + "id": None, + "cmsLocaleId": None, + "enabled": None, + "displayName": None, + "redirect": None, + "subdirectory": None, + "tag": None, + }, + }, + ), + }, + "dataCollectionEnabled": None, + "dataCollectionType": None, + }, + 1: { + "id": None, + "workspaceId": None, + "createdOn": "datetime", + "displayName": None, + "shortName": None, + "lastPublished": "datetime", + "lastUpdated": "datetime", + "previewUrl": None, + "timeZone": None, + "parentFolderId": None, + "customDomains": ("list", {0: {"id": None, "url": None}}), + "locales": { + "primary": { + "id": None, + "cmsLocaleId": None, + "enabled": None, + "displayName": None, + "redirect": None, + "subdirectory": None, + "tag": None, + }, + "secondary": ( + "list", + { + 0: { + "id": None, + "cmsLocaleId": None, + "enabled": None, + "displayName": None, + "redirect": None, + "subdirectory": None, + "tag": None, + } + }, + ), + }, + "dataCollectionEnabled": None, + "dataCollectionType": None, + }, + 2: { + "id": None, + "workspaceId": None, + "createdOn": "datetime", + "displayName": None, + "shortName": None, + "lastPublished": "datetime", + "lastUpdated": "datetime", + "previewUrl": None, + "timeZone": None, + "parentFolderId": None, + "customDomains": ("list", {0: {"id": None, "url": None}}), + "locales": { + "primary": { + "id": None, + "cmsLocaleId": None, + "enabled": None, + "displayName": None, + "redirect": None, + "subdirectory": None, + "tag": None, + }, + "secondary": ( + "list", + { + 0: { + "id": None, + "cmsLocaleId": None, + "enabled": None, + "displayName": None, + "redirect": None, + "subdirectory": None, + "tag": None, + } + }, + ), + }, + "dataCollectionEnabled": None, + "dataCollectionType": None, + }, + }, + ) + } + response = client.sites.list() + validate_response(response, expected_response, expected_types) + + async_response = await async_client.sites.list() + validate_response(async_response, expected_response, expected_types) + + +async def test_get(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "id": "42e98c9a982ac9b8b742", + "workspaceId": "42e63e98c9a982ac9b8b742", + "createdOn": "1979-10-12T12:00:00Z", + "displayName": "The Hitchhiker's Guide to the Galaxy", + "shortName": "hitchhikers-guide", + "lastPublished": "2023-04-02T12:42:00Z", + "lastUpdated": "2023-04-02T12:42:00Z", + "previewUrl": "https://screenshots.webflow.com/sites/6258612d1ee792848f805dcf/20231219211811_d5990556c743f33b7071300a03bf67e6.png", + "timeZone": "Magrathea/FactoryFloor", + "parentFolderId": "1as2d3f4g5h6j7k8l9z0x1c2v3b4n5m6", + "customDomains": [ + {"id": "589a331aa51e760df7ccb89d", "url": "hitchhikersguide.galaxy"}, + {"id": "589a331aa51e760df7ccb89e", "url": "heartofgold.spaceship"}, + ], + "locales": { + "primary": { + "id": "653fd9af6a07fc9cfd7a5e57", + "cmsLocaleId": "653ad57de882f528b32e810e", + "enabled": False, + "displayName": "English (United States)", + "displayImageId": "displayImageId", + "redirect": True, + "subdirectory": "", + "tag": "en-US", + }, + "secondary": [ + { + "id": "653fd9af6a07fc9cfd7a5e57", + "cmsLocaleId": "653ad57de882f528b32e810e", + "enabled": False, + "displayName": "English (United States)", + "redirect": True, + "subdirectory": "", + "tag": "en-US", + } + ], + }, + "dataCollectionEnabled": True, + "dataCollectionType": "always", + } + expected_types: typing.Any = { + "id": None, + "workspaceId": None, + "createdOn": "datetime", + "displayName": None, + "shortName": None, + "lastPublished": "datetime", + "lastUpdated": "datetime", + "previewUrl": None, + "timeZone": None, + "parentFolderId": None, + "customDomains": ("list", {0: {"id": None, "url": None}, 1: {"id": None, "url": None}}), + "locales": { + "primary": { + "id": None, + "cmsLocaleId": None, + "enabled": None, + "displayName": None, + "displayImageId": None, + "redirect": None, + "subdirectory": None, + "tag": None, + }, + "secondary": ( + "list", + { + 0: { + "id": None, + "cmsLocaleId": None, + "enabled": None, + "displayName": None, + "redirect": None, + "subdirectory": None, + "tag": None, + } + }, + ), + }, + "dataCollectionEnabled": None, + "dataCollectionType": None, + } + response = client.sites.get(site_id="580e63e98c9a982ac9b8b741") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.sites.get(site_id="580e63e98c9a982ac9b8b741") + validate_response(async_response, expected_response, expected_types) + + +async def test_get_custom_domain(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "customDomains": [ + {"id": "589a331aa51e760df7ccb89d", "url": "hitchhikersguide.galaxy"}, + {"id": "589a331aa51e760df7ccb89e", "url": "heartofgold.spaceship"}, + ] + } + expected_types: typing.Any = { + "customDomains": ("list", {0: {"id": None, "url": None}, 1: {"id": None, "url": None}}) + } + response = client.sites.get_custom_domain(site_id="580e63e98c9a982ac9b8b741") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.sites.get_custom_domain(site_id="580e63e98c9a982ac9b8b741") + validate_response(async_response, expected_response, expected_types) + + +async def test_publish(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "customDomains": [{"id": "589a331aa51e760df7ccb89d", "url": "test-api-domain.com"}], + "publishToWebflowSubdomain": True, + } + expected_types: typing.Any = { + "customDomains": ("list", {0: {"id": None, "url": None}}), + "publishToWebflowSubdomain": None, + } + response = client.sites.publish(site_id="580e63e98c9a982ac9b8b741") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.sites.publish(site_id="580e63e98c9a982ac9b8b741") + validate_response(async_response, expected_response, expected_types) diff --git a/tests/test_token.py b/tests/test_token.py new file mode 100644 index 0000000..aa5a9b8 --- /dev/null +++ b/tests/test_token.py @@ -0,0 +1,67 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from webflow.client import AsyncWebflow, Webflow + +from .utilities import validate_response + + +async def test_authorized_by(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "id": "545bbecb7bdd6769632504a7", + "email": "some@email.com", + "firstName": "Some", + "lastName": "One", + } + expected_types: typing.Any = {"id": None, "email": None, "firstName": None, "lastName": None} + response = client.token.authorized_by() + validate_response(response, expected_response, expected_types) + + async_response = await async_client.token.authorized_by() + validate_response(async_response, expected_response, expected_types) + + +async def test_introspect(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "authorization": { + "id": "55818d58616600637b9a5786", + "createdOn": "2016-10-03T23:12:00Z", + "lastUsed": "2016-10-10T21:41:12Z", + "grantType": "authorization_code", + "rateLimit": 60, + "scope": "assets:read,assets:write", + "authorizedTo": { + "siteIds": ["62f3b1f7eafac55d0c64ef91"], + "workspaceIds": ["52f3b1f7eafac55d0c64ef91"], + "userIds": ["545bbecb7bdd6769632504a7"], + }, + }, + "application": { + "id": "55131cd036c09f7d07883dfc", + "description": "My Amazing App", + "homepage": "https://webflow.com", + "displayName": "My Amazing App", + }, + } + expected_types: typing.Any = { + "authorization": { + "id": None, + "createdOn": "datetime", + "lastUsed": "datetime", + "grantType": None, + "rateLimit": "integer", + "scope": None, + "authorizedTo": { + "siteIds": ("list", {0: None}), + "workspaceIds": ("list", {0: None}), + "userIds": ("list", {0: None}), + }, + }, + "application": None, + } + response = client.token.introspect() + validate_response(response, expected_response, expected_types) + + async_response = await async_client.token.introspect() + validate_response(async_response, expected_response, expected_types) diff --git a/tests/test_users.py b/tests/test_users.py new file mode 100644 index 0000000..4dfe5c5 --- /dev/null +++ b/tests/test_users.py @@ -0,0 +1,296 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from webflow import UsersUpdateRequestData +from webflow.client import AsyncWebflow, Webflow + +from .utilities import validate_response + + +async def test_list_(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "count": 5, + "limit": 5, + "offset": 0, + "total": 201, + "users": [ + { + "id": "6287ec36a841b25637c663df", + "isEmailVerified": False, + "lastUpdated": "2022-05-20T13:46:12Z", + "invitedOn": "2016-10-24T19:41:29Z", + "createdOn": "2022-05-20T13:46:12Z", + "lastLogin": "2016-10-24T19:41:29Z", + "status": "unverified", + "accessGroups": [{"slug": "vogon-construction-crew", "type": "admin"}], + }, + { + "id": "6287ec36a841b25637c663f0", + "isEmailVerified": False, + "lastUpdated": "2022-05-19T05:32:04Z", + "invitedOn": "2016-10-24T19:41:29Z", + "createdOn": "2022-05-19T05:32:04Z", + "lastLogin": "2016-10-24T19:41:29Z", + "status": "unverified", + "accessGroups": [{"slug": "improbability-drive-test-subjects", "type": "admin"}], + }, + { + "id": "6287ec36a841b25637c663d9", + "isEmailVerified": True, + "lastUpdated": "2022-05-17T03:34:06Z", + "invitedOn": "2016-10-24T19:41:29Z", + "createdOn": "2022-05-17T03:34:06Z", + "lastLogin": "2016-10-24T19:41:29Z", + "status": "verified", + "accessGroups": [{"slug": "heart-of-gold-crew", "type": "admin"}], + }, + { + "id": "6287ec37a841b25637c6641b", + "isEmailVerified": False, + "lastUpdated": "2022-05-15T03:46:09Z", + "invitedOn": "2016-10-24T19:41:29Z", + "createdOn": "2022-05-15T03:46:09Z", + "lastLogin": "2016-10-24T19:41:29Z", + "status": "unverified", + "accessGroups": [{"slug": "hitchhikers-guide-research-team", "type": "admin"}], + }, + { + "id": "6287ec37a841b25637c66449", + "isEmailVerified": True, + "lastUpdated": "2022-05-15T02:55:38Z", + "invitedOn": "2016-10-24T19:41:29Z", + "createdOn": "2022-05-15T02:55:38Z", + "lastLogin": "2016-10-24T19:41:29Z", + "status": "verified", + "accessGroups": [{"slug": "milliways-reservationists", "type": "admin"}], + }, + ], + } + expected_types: typing.Any = { + "count": None, + "limit": None, + "offset": None, + "total": None, + "users": ( + "list", + { + 0: { + "id": None, + "isEmailVerified": None, + "lastUpdated": "datetime", + "invitedOn": "datetime", + "createdOn": "datetime", + "lastLogin": "datetime", + "status": None, + "accessGroups": ("list", {0: {"slug": None, "type": None}}), + }, + 1: { + "id": None, + "isEmailVerified": None, + "lastUpdated": "datetime", + "invitedOn": "datetime", + "createdOn": "datetime", + "lastLogin": "datetime", + "status": None, + "accessGroups": ("list", {0: {"slug": None, "type": None}}), + }, + 2: { + "id": None, + "isEmailVerified": None, + "lastUpdated": "datetime", + "invitedOn": "datetime", + "createdOn": "datetime", + "lastLogin": "datetime", + "status": None, + "accessGroups": ("list", {0: {"slug": None, "type": None}}), + }, + 3: { + "id": None, + "isEmailVerified": None, + "lastUpdated": "datetime", + "invitedOn": "datetime", + "createdOn": "datetime", + "lastLogin": "datetime", + "status": None, + "accessGroups": ("list", {0: {"slug": None, "type": None}}), + }, + 4: { + "id": None, + "isEmailVerified": None, + "lastUpdated": "datetime", + "invitedOn": "datetime", + "createdOn": "datetime", + "lastLogin": "datetime", + "status": None, + "accessGroups": ("list", {0: {"slug": None, "type": None}}), + }, + }, + ), + } + response = client.users.list(site_id="580e63e98c9a982ac9b8b741") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.users.list(site_id="580e63e98c9a982ac9b8b741") + validate_response(async_response, expected_response, expected_types) + + +async def test_get(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "id": "6287ec36a841b25637c663df", + "isEmailVerified": True, + "lastUpdated": "2022-05-20T13:46:12Z", + "invitedOn": "2022-05-20T13:46:12Z", + "createdOn": "2022-05-20T13:46:12Z", + "lastLogin": "2022-05-20T13:46:12Z", + "status": "verified", + "accessGroups": [{"slug": "webflowers", "type": "admin"}], + "data": { + "data": { + "name": "name", + "email": "email", + "accept-privacy": True, + "accept-communications": True, + "additionalProperties": "additionalProperties", + } + }, + } + expected_types: typing.Any = { + "id": None, + "isEmailVerified": None, + "lastUpdated": "datetime", + "invitedOn": "datetime", + "createdOn": "datetime", + "lastLogin": "datetime", + "status": None, + "accessGroups": ("list", {0: {"slug": None, "type": None}}), + "data": { + "data": { + "name": None, + "email": None, + "accept-privacy": None, + "accept-communications": None, + "additionalProperties": None, + } + }, + } + response = client.users.get(site_id="580e63e98c9a982ac9b8b741", user_id="580e63e98c9a982ac9b8b741") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.users.get( + site_id="580e63e98c9a982ac9b8b741", user_id="580e63e98c9a982ac9b8b741" + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_delete(client: Webflow, async_client: AsyncWebflow) -> None: + # Type ignore to avoid mypy complaining about the function not being meant to return a value + assert client.users.delete(site_id="580e63e98c9a982ac9b8b741", user_id="580e63e98c9a982ac9b8b741") is None # type: ignore[func-returns-value] + + assert await async_client.users.delete(site_id="580e63e98c9a982ac9b8b741", user_id="580e63e98c9a982ac9b8b741") is None # type: ignore[func-returns-value] + + +async def test_update(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "id": "6287ec36a841b25637c663df", + "isEmailVerified": True, + "lastUpdated": "2022-05-20T13:46:12Z", + "invitedOn": "2022-05-20T13:46:12Z", + "createdOn": "2022-05-20T13:46:12Z", + "lastLogin": "2022-05-20T13:46:12Z", + "status": "verified", + "accessGroups": [{"slug": "webflowers", "type": "admin"}], + "data": { + "data": { + "name": "name", + "email": "email", + "accept-privacy": True, + "accept-communications": True, + "additionalProperties": "additionalProperties", + } + }, + } + expected_types: typing.Any = { + "id": None, + "isEmailVerified": None, + "lastUpdated": "datetime", + "invitedOn": "datetime", + "createdOn": "datetime", + "lastLogin": "datetime", + "status": None, + "accessGroups": ("list", {0: {"slug": None, "type": None}}), + "data": { + "data": { + "name": None, + "email": None, + "accept-privacy": None, + "accept-communications": None, + "additionalProperties": None, + } + }, + } + response = client.users.update( + site_id="580e63e98c9a982ac9b8b741", + user_id="580e63e98c9a982ac9b8b741", + data=UsersUpdateRequestData(name="Some One", accept_privacy=False, accept_communications=False), + access_groups=["webflowers", "platinum", "free-tier"], + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.users.update( + site_id="580e63e98c9a982ac9b8b741", + user_id="580e63e98c9a982ac9b8b741", + data=UsersUpdateRequestData(name="Some One", accept_privacy=False, accept_communications=False), + access_groups=["webflowers", "platinum", "free-tier"], + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_invite(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "id": "6287ec36a841b25637c663df", + "isEmailVerified": True, + "lastUpdated": "2022-05-20T13:46:12Z", + "invitedOn": "2022-05-20T13:46:12Z", + "createdOn": "2022-05-20T13:46:12Z", + "lastLogin": "2022-05-20T13:46:12Z", + "status": "verified", + "accessGroups": [{"slug": "webflowers", "type": "admin"}], + "data": { + "data": { + "name": "name", + "email": "email", + "accept-privacy": True, + "accept-communications": True, + "additionalProperties": "additionalProperties", + } + }, + } + expected_types: typing.Any = { + "id": None, + "isEmailVerified": None, + "lastUpdated": "datetime", + "invitedOn": "datetime", + "createdOn": "datetime", + "lastLogin": "datetime", + "status": None, + "accessGroups": ("list", {0: {"slug": None, "type": None}}), + "data": { + "data": { + "name": None, + "email": None, + "accept-privacy": None, + "accept-communications": None, + "additionalProperties": None, + } + }, + } + response = client.users.invite( + site_id="580e63e98c9a982ac9b8b741", email="some.one@home.com", access_groups=["webflowers"] + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.users.invite( + site_id="580e63e98c9a982ac9b8b741", email="some.one@home.com", access_groups=["webflowers"] + ) + validate_response(async_response, expected_response, expected_types) diff --git a/tests/test_webhooks.py b/tests/test_webhooks.py new file mode 100644 index 0000000..2b24a41 --- /dev/null +++ b/tests/test_webhooks.py @@ -0,0 +1,171 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime +import typing + +from webflow import TriggerType +from webflow.client import AsyncWebflow, Webflow + +from .utilities import validate_response + + +async def test_list_(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "pagination": {"limit": 100, "offset": 0, "total": 100}, + "webhooks": [ + { + "id": "57ca0a9e418c504a6e1acbb6", + "triggerType": "form_submission", + "url": "https://webhook.site/7f7f7f7f-7f7f-7f7f-7f7f-7f7f7f7f7f7f", + "workspaceId": "4f4e46fd476ea8c507000001", + "siteId": "562ac0395358780a1f5e6fbd", + "filter": {"name": "Email Form"}, + "lastTriggered": "2023-02-08T23:59:28Z", + "createdOn": "2016-09-02T23:26:22Z", + }, + { + "id": "578d85cce0c47cd2865f4cf2", + "triggerType": "form_submission", + "url": "https://webhook.site/7f7f7f7f-7f7f-7f7f-7f7f-7f7f7f7f7f7f", + "workspaceId": "4f4e46fd476ea8c507000001", + "siteId": "562ac0395358780a1f5e6fbd", + "filter": {"name": "Email Form"}, + "lastTriggered": "2023-02-08T23:59:28Z", + "createdOn": "2016-07-19T01:43:40Z", + }, + { + "id": "578d85cce0c47cd2865f4cf3", + "triggerType": "form_submission", + "url": "https://webhook.site/7f7f7f7f-7f7f-7f7f-7f7f-7f7f7f7f7f7f", + "workspaceId": "4f4e46fd476ea8c507000001", + "siteId": "562ac0395358780a1f5e6fbd", + "filter": {"name": "Email Form"}, + "lastTriggered": "2023-02-08T23:59:28Z", + "createdOn": "2016-07-19T01:43:40Z", + }, + ], + } + expected_types: typing.Any = { + "pagination": {"limit": None, "offset": None, "total": None}, + "webhooks": ( + "list", + { + 0: { + "id": None, + "triggerType": None, + "url": None, + "workspaceId": None, + "siteId": None, + "filter": {"name": None}, + "lastTriggered": "datetime", + "createdOn": "datetime", + }, + 1: { + "id": None, + "triggerType": None, + "url": None, + "workspaceId": None, + "siteId": None, + "filter": {"name": None}, + "lastTriggered": "datetime", + "createdOn": "datetime", + }, + 2: { + "id": None, + "triggerType": None, + "url": None, + "workspaceId": None, + "siteId": None, + "filter": {"name": None}, + "lastTriggered": "datetime", + "createdOn": "datetime", + }, + }, + ), + } + response = client.webhooks.list(site_id="580e63e98c9a982ac9b8b741") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.webhooks.list(site_id="580e63e98c9a982ac9b8b741") + validate_response(async_response, expected_response, expected_types) + + +async def test_create(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "id": "582266e0cd48de0f0e3c6d8b", + "triggerType": "form_submission", + "url": "https://webhook.site/7f7f7f7f-7f7f-7f7f-7f7f-7f7f7f7f7f7f", + "workspaceId": "4f4e46fd476ea8c507000001", + "siteId": "562ac0395358780a1f5e6fbd", + "filter": {"name": "My Form"}, + "lastTriggered": "2023-02-08T23:59:28Z", + "createdOn": "2022-11-08T23:59:28Z", + } + expected_types: typing.Any = { + "id": None, + "triggerType": None, + "url": None, + "workspaceId": None, + "siteId": None, + "filter": {"name": None}, + "lastTriggered": "datetime", + "createdOn": "datetime", + } + response = client.webhooks.create( + site_id_="580e63e98c9a982ac9b8b741", + id="582266e0cd48de0f0e3c6d8b", + trigger_type=TriggerType.FORM_SUBMISSION, + url="https://webhook.site/7f7f7f7f-7f7f-7f7f-7f7f-7f7f7f7f7f7f", + workspace_id="4f4e46fd476ea8c507000001", + site_id="562ac0395358780a1f5e6fbd", + last_triggered=datetime.datetime.fromisoformat("2023-02-08 23:59:28+00:00"), + created_on=datetime.datetime.fromisoformat("2022-11-08 23:59:28+00:00"), + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.webhooks.create( + site_id_="580e63e98c9a982ac9b8b741", + id="582266e0cd48de0f0e3c6d8b", + trigger_type=TriggerType.FORM_SUBMISSION, + url="https://webhook.site/7f7f7f7f-7f7f-7f7f-7f7f-7f7f7f7f7f7f", + workspace_id="4f4e46fd476ea8c507000001", + site_id="562ac0395358780a1f5e6fbd", + last_triggered=datetime.datetime.fromisoformat("2023-02-08 23:59:28+00:00"), + created_on=datetime.datetime.fromisoformat("2022-11-08 23:59:28+00:00"), + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_get(client: Webflow, async_client: AsyncWebflow) -> None: + expected_response: typing.Any = { + "id": "582266e0cd48de0f0e3c6d8b", + "triggerType": "form_submission", + "url": "https://webhook.site/7f7f7f7f-7f7f-7f7f-7f7f-7f7f7f7f7f7f", + "workspaceId": "4f4e46fd476ea8c507000001", + "siteId": "562ac0395358780a1f5e6fbd", + "filter": {"name": "My Form"}, + "lastTriggered": "2023-02-08T23:59:28Z", + "createdOn": "2022-11-08T23:59:28Z", + } + expected_types: typing.Any = { + "id": None, + "triggerType": None, + "url": None, + "workspaceId": None, + "siteId": None, + "filter": {"name": None}, + "lastTriggered": "datetime", + "createdOn": "datetime", + } + response = client.webhooks.get(webhook_id="580e64008c9a982ac9b8b754") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.webhooks.get(webhook_id="580e64008c9a982ac9b8b754") + validate_response(async_response, expected_response, expected_types) + + +async def test_delete(client: Webflow, async_client: AsyncWebflow) -> None: + # Type ignore to avoid mypy complaining about the function not being meant to return a value + assert client.webhooks.delete(webhook_id="580e64008c9a982ac9b8b754") is None # type: ignore[func-returns-value] + + assert await async_client.webhooks.delete(webhook_id="580e64008c9a982ac9b8b754") is None # type: ignore[func-returns-value] diff --git a/tests/utilities.py b/tests/utilities.py new file mode 100644 index 0000000..402ee79 --- /dev/null +++ b/tests/utilities.py @@ -0,0 +1,123 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +import uuid + +import pydantic +from dateutil import parser + +IS_PYDANTIC_V2 = pydantic.VERSION.startswith("2.") + +if IS_PYDANTIC_V2: + import pydantic.v1 as pydantic_v1 # type: ignore # nopycln: import +else: + import pydantic as pydantic_v1 # type: ignore # nopycln: import + + +def cast_field(json_expectation: typing.Any, type_expectation: typing.Any) -> typing.Any: + # Cast these specific types which come through as string and expect our + # models to cast to the correct type. + if type_expectation == "uuid": + return uuid.UUID(json_expectation) + elif type_expectation == "date": + return parser.parse(json_expectation).date() + elif type_expectation == "datetime": + return parser.parse(json_expectation) + elif type_expectation == "set": + return set(json_expectation) + elif type_expectation == "integer": + # Necessary as we allow numeric keys, but JSON makes them strings + return int(json_expectation) + + return json_expectation + + +def validate_field(response: typing.Any, json_expectation: typing.Any, type_expectation: typing.Any) -> None: + # Allow for an escape hatch if the object cannot be validated + if type_expectation == "no_validate": + return + + is_container_of_complex_type = False + # Parse types in containers, note that dicts are handled within `validate_response` + if isinstance(json_expectation, list): + if isinstance(type_expectation, tuple): + container_expectation = type_expectation[0] + contents_expectation = type_expectation[1] + + cast_json_expectation = [] + for idx, ex in enumerate(json_expectation): + if isinstance(contents_expectation, dict): + entry_expectation = contents_expectation.get(idx) + if isinstance(entry_expectation, dict): + is_container_of_complex_type = True + validate_response( + response=response[idx], json_expectation=ex, type_expectations=entry_expectation + ) + else: + cast_json_expectation.append(cast_field(ex, entry_expectation)) + else: + cast_json_expectation.append(ex) + json_expectation = cast_json_expectation + + # Note that we explicitly do not allow for sets of pydantic models as they are not hashable, so + # if any of the values of the set have a type_expectation of a dict, we're assuming it's a pydantic + # model and keeping it a list. + if container_expectation != "set" or not any( + map(lambda value: isinstance(value, dict), list(contents_expectation.values())) + ): + json_expectation = cast_field(json_expectation, container_expectation) + elif isinstance(type_expectation, tuple): + container_expectation = type_expectation[0] + contents_expectation = type_expectation[1] + if isinstance(contents_expectation, dict): + json_expectation = { + cast_field( + key, contents_expectation.get(idx)[0] if contents_expectation.get(idx) is not None else None # type: ignore + ): cast_field( + value, contents_expectation.get(idx)[1] if contents_expectation.get(idx) is not None else None # type: ignore + ) + for idx, (key, value) in enumerate(json_expectation.items()) + } + else: + json_expectation = cast_field(json_expectation, container_expectation) + elif type_expectation is not None: + json_expectation = cast_field(json_expectation, type_expectation) + + # When dealing with containers of models, etc. we're validating them implicitly, so no need to check the resultant list + if not is_container_of_complex_type: + assert json_expectation == response, "Primitives found, expected: {0}, Actual: {1}".format( + json_expectation, response + ) + + +# Arg type_expectations is a deeply nested structure that matches the response, but with the values replaced with the expected types +def validate_response(response: typing.Any, json_expectation: typing.Any, type_expectations: typing.Any) -> None: + # Allow for an escape hatch if the object cannot be validated + if type_expectations == "no_validate": + return + + if not isinstance(response, dict) and not issubclass(type(response), pydantic_v1.BaseModel): + validate_field(response=response, json_expectation=json_expectation, type_expectation=type_expectations) + return + + response_json = response + if issubclass(type(response), pydantic_v1.BaseModel): + response_json = response.dict(by_alias=True) + + for key, value in json_expectation.items(): + assert key in response_json, "Field {0} not found within the response object: {1}".format(key, response_json) + + type_expectation = None + if type_expectations is not None and isinstance(type_expectations, dict): + type_expectation = type_expectations.get(key) + + # If your type_expectation is a tuple then you have a container field, process it as such + # Otherwise, we're just validating a single field that's a pydantic model. + if isinstance(value, dict) and not isinstance(type_expectation, tuple): + validate_response(response=response_json[key], json_expectation=value, type_expectations=type_expectation) + else: + validate_field(response=response_json[key], json_expectation=value, type_expectation=type_expectation) + + # Ensure there are no additional fields here either + del response_json[key] + assert len(response_json) == 0, "Additional fields found, expected None: {0}".format(response_json)