From c57c19b18ae41e1d7e65547d1911c8a2773500ed Mon Sep 17 00:00:00 2001 From: guitavano Date: Mon, 27 Jul 2026 11:23:20 -0300 Subject: [PATCH] chore(vtex): regenerate client from current upstream schemas MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Regenerates the hey-api client from the latest VTEX OpenAPI schemas. Upstream renamed several operations and removed two; this reconciles the tool registry so no tool references a now-undefined SDK export. Renamed operations (registry references updated): - punchout: {get,post}ApiAuthenticatorPunchout* -> *V1Punchout* - vtex-id: postApiAuthenticatorStorefrontUsers -> *V1StorefrontUsers - delivery-promise-notification: {put,patch}DeliveryPromisesExternalSellers* -> {put,patch}ApiDeliveryPromisesExternalSellers* Removed tools (endpoints no longer in upstream schemas): - VTEX_GET_ROLES_BY_USER2 (getRolesbyUser2) — alternate endpoint dropped; VTEX_GET_ROLES_BY_USER (getRolesbyUser) remains. - VTEX_ORDER_CHANGES_POST_CHANGE (postOrderChanges) — removed from the pick-and-pack-order-changes schema. Prereq for enabling zod metadata (param descriptions): doing that regen on top of a current client yields a description-only diff. Build is warning-free; all 104 tests pass. metadata stays false here (no bundle change). Co-Authored-By: Claude Opus 4.8 --- vtex/server/generated/ads/index.ts | 4 +- vtex/server/generated/ads/sdk.gen.ts | 228 +- vtex/server/generated/ads/types.gen.ts | 2993 +++++++++++++++-- vtex/server/generated/ads/zod.gen.ts | 430 ++- .../generated/b2b-addresses/client.gen.ts | 16 + .../b2b-addresses/client/client.gen.ts | 288 ++ .../generated/b2b-addresses/client/index.ts | 25 + .../b2b-addresses/client/types.gen.ts | 213 ++ .../b2b-addresses/client/utils.gen.ts | 316 ++ .../generated/b2b-addresses/core/auth.gen.ts | 41 + .../b2b-addresses/core/bodySerializer.gen.ts | 84 + .../b2b-addresses/core/params.gen.ts | 169 + .../b2b-addresses/core/pathSerializer.gen.ts | 171 + .../core/queryKeySerializer.gen.ts | 117 + .../core/serverSentEvents.gen.ts | 243 ++ .../generated/b2b-addresses/core/types.gen.ts | 104 + .../generated/b2b-addresses/core/utils.gen.ts | 140 + vtex/server/generated/b2b-addresses/index.ts | 4 + .../server/generated/b2b-addresses/sdk.gen.ts | 518 +++ .../generated/b2b-addresses/types.gen.ts | 937 ++++++ .../server/generated/b2b-addresses/zod.gen.ts | 385 +++ .../generated/b2b-buyer-data/types.gen.ts | 12 +- .../server/generated/b2b-contracts/sdk.gen.ts | 12 +- .../generated/b2b-contracts/types.gen.ts | 12 +- .../server/generated/b2b-contracts/zod.gen.ts | 4 +- .../client.gen.ts | 16 + .../client/client.gen.ts | 288 ++ .../client/index.ts | 25 + .../client/types.gen.ts | 213 ++ .../client/utils.gen.ts | 316 ++ .../core/auth.gen.ts | 41 + .../core/bodySerializer.gen.ts | 84 + .../core/params.gen.ts | 169 + .../core/pathSerializer.gen.ts | 171 + .../core/queryKeySerializer.gen.ts | 117 + .../core/serverSentEvents.gen.ts | 243 ++ .../core/types.gen.ts | 104 + .../core/utils.gen.ts | 140 + .../b2b-password-migration-protocol/index.ts | 4 + .../sdk.gen.ts | 125 + .../types.gen.ts | 147 + .../zod.gen.ts | 38 + .../generated/bulk-pricing/client.gen.ts | 16 + .../bulk-pricing/client/client.gen.ts | 288 ++ .../generated/bulk-pricing/client/index.ts | 25 + .../bulk-pricing/client/types.gen.ts | 213 ++ .../bulk-pricing/client/utils.gen.ts | 316 ++ .../generated/bulk-pricing/core/auth.gen.ts | 41 + .../bulk-pricing/core/bodySerializer.gen.ts | 84 + .../generated/bulk-pricing/core/params.gen.ts | 169 + .../bulk-pricing/core/pathSerializer.gen.ts | 171 + .../core/queryKeySerializer.gen.ts | 117 + .../bulk-pricing/core/serverSentEvents.gen.ts | 243 ++ .../generated/bulk-pricing/core/types.gen.ts | 104 + .../generated/bulk-pricing/core/utils.gen.ts | 140 + vtex/server/generated/bulk-pricing/index.ts | 4 + vtex/server/generated/bulk-pricing/sdk.gen.ts | 121 + .../generated/bulk-pricing/types.gen.ts | 262 ++ vtex/server/generated/bulk-pricing/zod.gen.ts | 53 + .../generated/buying-policies/sdk.gen.ts | 10 +- .../generated/buying-policies/types.gen.ts | 8 +- vtex/server/generated/catalog/index.ts | 4 +- vtex/server/generated/catalog/sdk.gen.ts | 416 ++- vtex/server/generated/catalog/types.gen.ts | 474 ++- vtex/server/generated/catalog/zod.gen.ts | 147 + vtex/server/generated/checkout/index.ts | 4 +- vtex/server/generated/checkout/sdk.gen.ts | 203 +- vtex/server/generated/checkout/types.gen.ts | 553 ++- vtex/server/generated/checkout/zod.gen.ts | 158 +- .../generated/default-values/types.gen.ts | 2 +- .../delivery-promise-notification/index.ts | 4 +- .../delivery-promise-notification/sdk.gen.ts | 38 +- .../types.gen.ts | 60 +- .../delivery-promise-notification/zod.gen.ts | 10 +- .../client.gen.ts | 16 + .../client/client.gen.ts | 288 ++ .../client/index.ts | 25 + .../client/types.gen.ts | 213 ++ .../client/utils.gen.ts | 316 ++ .../core/auth.gen.ts | 41 + .../core/bodySerializer.gen.ts | 84 + .../core/params.gen.ts | 169 + .../core/pathSerializer.gen.ts | 171 + .../core/queryKeySerializer.gen.ts | 117 + .../core/serverSentEvents.gen.ts | 243 ++ .../core/types.gen.ts | 104 + .../core/utils.gen.ts | 140 + .../delivery-promise-suggestions/index.ts | 4 + .../delivery-promise-suggestions/sdk.gen.ts | 157 + .../delivery-promise-suggestions/types.gen.ts | 448 +++ .../delivery-promise-suggestions/zod.gen.ts | 174 + .../client.gen.ts | 16 + .../client/client.gen.ts | 288 ++ .../client/index.ts | 25 + .../client/types.gen.ts | 213 ++ .../client/utils.gen.ts | 316 ++ .../core/auth.gen.ts | 41 + .../core/bodySerializer.gen.ts | 84 + .../core/params.gen.ts | 169 + .../core/pathSerializer.gen.ts | 171 + .../core/queryKeySerializer.gen.ts | 117 + .../core/serverSentEvents.gen.ts | 243 ++ .../core/types.gen.ts | 104 + .../core/utils.gen.ts | 140 + .../external-promotions-protocol/index.ts | 4 + .../external-promotions-protocol/sdk.gen.ts | 53 + .../external-promotions-protocol/types.gen.ts | 503 +++ .../external-promotions-protocol/zod.gen.ts | 130 + .../giftcard-provider-protocol/zod.gen.ts | 12 +- .../intelligent-search-api-v1/client.gen.ts | 16 + .../client/client.gen.ts | 288 ++ .../intelligent-search-api-v1/client/index.ts | 25 + .../client/types.gen.ts | 213 ++ .../client/utils.gen.ts | 316 ++ .../core/auth.gen.ts | 41 + .../core/bodySerializer.gen.ts | 84 + .../core/params.gen.ts | 169 + .../core/pathSerializer.gen.ts | 171 + .../core/queryKeySerializer.gen.ts | 117 + .../core/serverSentEvents.gen.ts | 243 ++ .../core/types.gen.ts | 104 + .../core/utils.gen.ts | 140 + .../intelligent-search-api-v1/index.ts | 4 + .../intelligent-search-api-v1/sdk.gen.ts | 526 +++ .../intelligent-search-api-v1/types.gen.ts | 2259 +++++++++++++ .../intelligent-search-api-v1/zod.gen.ts | 750 +++++ .../generated/intelligent-search/sdk.gen.ts | 42 +- .../generated/intelligent-search/types.gen.ts | 484 ++- .../generated/intelligent-search/zod.gen.ts | 140 +- .../server/generated/license-manager/index.ts | 4 +- .../generated/license-manager/sdk.gen.ts | 57 +- .../generated/license-manager/types.gen.ts | 46 - .../generated/license-manager/zod.gen.ts | 12 - vtex/server/generated/logistics/index.ts | 4 +- vtex/server/generated/logistics/sdk.gen.ts | 216 +- vtex/server/generated/logistics/types.gen.ts | 395 ++- vtex/server/generated/logistics/zod.gen.ts | 49 +- .../marketplace-apis-suggestions/sdk.gen.ts | 170 +- .../marketplace-apis-suggestions/types.gen.ts | 22 +- .../marketplace-apis-suggestions/zod.gen.ts | 38 +- .../index.ts | 2 +- .../types.gen.ts | 183 +- .../zod.gen.ts | 99 +- .../index.ts | 2 +- .../types.gen.ts | 93 + .../zod.gen.ts | 77 +- .../generated/masterdata-api-v10-2/sdk.gen.ts | 2 + .../generated/organization-units/sdk.gen.ts | 2 +- .../generated/organization-units/types.gen.ts | 6 +- .../generated/payment-policies/client.gen.ts | 16 + .../payment-policies/client/client.gen.ts | 288 ++ .../payment-policies/client/index.ts | 25 + .../payment-policies/client/types.gen.ts | 213 ++ .../payment-policies/client/utils.gen.ts | 316 ++ .../payment-policies/core/auth.gen.ts | 41 + .../core/bodySerializer.gen.ts | 84 + .../payment-policies/core/params.gen.ts | 169 + .../core/pathSerializer.gen.ts | 171 + .../core/queryKeySerializer.gen.ts | 117 + .../core/serverSentEvents.gen.ts | 243 ++ .../payment-policies/core/types.gen.ts | 104 + .../payment-policies/core/utils.gen.ts | 140 + .../generated/payment-policies/index.ts | 4 + .../generated/payment-policies/sdk.gen.ts | 205 ++ .../generated/payment-policies/types.gen.ts | 660 ++++ .../generated/payment-policies/zod.gen.ts | 263 ++ .../payment-provider-protocol/sdk.gen.ts | 1 + .../generated/payments-gateway/sdk.gen.ts | 8 +- .../generated/payments-gateway/types.gen.ts | 148 +- .../generated/payments-gateway/zod.gen.ts | 153 +- .../pick-and-pack-order-changes/index.ts | 4 +- .../pick-and-pack-order-changes/sdk.gen.ts | 59 +- .../pick-and-pack-order-changes/types.gen.ts | 296 +- .../pick-and-pack-order-changes/zod.gen.ts | 99 +- vtex/server/generated/punchout/index.ts | 4 +- vtex/server/generated/punchout/sdk.gen.ts | 10 +- vtex/server/generated/punchout/types.gen.ts | 26 +- vtex/server/generated/punchout/zod.gen.ts | 6 +- .../generated/recommendations-bff/sdk.gen.ts | 93 +- .../recommendations-bff/types.gen.ts | 337 +- .../generated/recommendations-bff/zod.gen.ts | 55 +- .../shopee-integration/client.gen.ts | 16 + .../shopee-integration/client/client.gen.ts | 288 ++ .../shopee-integration/client/index.ts | 25 + .../shopee-integration/client/types.gen.ts | 213 ++ .../shopee-integration/client/utils.gen.ts | 316 ++ .../shopee-integration/core/auth.gen.ts | 41 + .../core/bodySerializer.gen.ts | 84 + .../shopee-integration/core/params.gen.ts | 169 + .../core/pathSerializer.gen.ts | 171 + .../core/queryKeySerializer.gen.ts | 117 + .../core/serverSentEvents.gen.ts | 243 ++ .../shopee-integration/core/types.gen.ts | 104 + .../shopee-integration/core/utils.gen.ts | 140 + .../generated/shopee-integration/index.ts | 4 + .../generated/shopee-integration/sdk.gen.ts | 93 + .../generated/shopee-integration/types.gen.ts | 173 + .../generated/shopee-integration/zod.gen.ts | 87 + vtex/server/generated/sku-bindings/sdk.gen.ts | 120 +- .../generated/sku-bindings/types.gen.ts | 8 +- .../generated/storefront-roles/index.ts | 4 +- .../generated/storefront-roles/sdk.gen.ts | 266 +- .../generated/storefront-roles/types.gen.ts | 877 +++++ .../generated/storefront-roles/zod.gen.ts | 113 + .../generated/user-rights/client.gen.ts | 16 + .../user-rights/client/client.gen.ts | 288 ++ .../generated/user-rights/client/index.ts | 25 + .../generated/user-rights/client/types.gen.ts | 213 ++ .../generated/user-rights/client/utils.gen.ts | 316 ++ .../generated/user-rights/core/auth.gen.ts | 41 + .../user-rights/core/bodySerializer.gen.ts | 84 + .../generated/user-rights/core/params.gen.ts | 169 + .../user-rights/core/pathSerializer.gen.ts | 171 + .../core/queryKeySerializer.gen.ts | 117 + .../user-rights/core/serverSentEvents.gen.ts | 243 ++ .../generated/user-rights/core/types.gen.ts | 104 + .../generated/user-rights/core/utils.gen.ts | 140 + vtex/server/generated/user-rights/index.ts | 4 + vtex/server/generated/user-rights/sdk.gen.ts | 67 + .../server/generated/user-rights/types.gen.ts | 101 + vtex/server/generated/user-rights/zod.gen.ts | 36 + vtex/server/generated/vtex-id/index.ts | 4 +- vtex/server/generated/vtex-id/sdk.gen.ts | 230 +- vtex/server/generated/vtex-id/types.gen.ts | 597 +++- vtex/server/generated/vtex-id/zod.gen.ts | 107 +- vtex/server/tools/registry.ts | 37 +- 226 files changed, 36683 insertions(+), 1572 deletions(-) create mode 100644 vtex/server/generated/b2b-addresses/client.gen.ts create mode 100644 vtex/server/generated/b2b-addresses/client/client.gen.ts create mode 100644 vtex/server/generated/b2b-addresses/client/index.ts create mode 100644 vtex/server/generated/b2b-addresses/client/types.gen.ts create mode 100644 vtex/server/generated/b2b-addresses/client/utils.gen.ts create mode 100644 vtex/server/generated/b2b-addresses/core/auth.gen.ts create mode 100644 vtex/server/generated/b2b-addresses/core/bodySerializer.gen.ts create mode 100644 vtex/server/generated/b2b-addresses/core/params.gen.ts create mode 100644 vtex/server/generated/b2b-addresses/core/pathSerializer.gen.ts create mode 100644 vtex/server/generated/b2b-addresses/core/queryKeySerializer.gen.ts create mode 100644 vtex/server/generated/b2b-addresses/core/serverSentEvents.gen.ts create mode 100644 vtex/server/generated/b2b-addresses/core/types.gen.ts create mode 100644 vtex/server/generated/b2b-addresses/core/utils.gen.ts create mode 100644 vtex/server/generated/b2b-addresses/index.ts create mode 100644 vtex/server/generated/b2b-addresses/sdk.gen.ts create mode 100644 vtex/server/generated/b2b-addresses/types.gen.ts create mode 100644 vtex/server/generated/b2b-addresses/zod.gen.ts create mode 100644 vtex/server/generated/b2b-password-migration-protocol/client.gen.ts create mode 100644 vtex/server/generated/b2b-password-migration-protocol/client/client.gen.ts create mode 100644 vtex/server/generated/b2b-password-migration-protocol/client/index.ts create mode 100644 vtex/server/generated/b2b-password-migration-protocol/client/types.gen.ts create mode 100644 vtex/server/generated/b2b-password-migration-protocol/client/utils.gen.ts create mode 100644 vtex/server/generated/b2b-password-migration-protocol/core/auth.gen.ts create mode 100644 vtex/server/generated/b2b-password-migration-protocol/core/bodySerializer.gen.ts create mode 100644 vtex/server/generated/b2b-password-migration-protocol/core/params.gen.ts create mode 100644 vtex/server/generated/b2b-password-migration-protocol/core/pathSerializer.gen.ts create mode 100644 vtex/server/generated/b2b-password-migration-protocol/core/queryKeySerializer.gen.ts create mode 100644 vtex/server/generated/b2b-password-migration-protocol/core/serverSentEvents.gen.ts create mode 100644 vtex/server/generated/b2b-password-migration-protocol/core/types.gen.ts create mode 100644 vtex/server/generated/b2b-password-migration-protocol/core/utils.gen.ts create mode 100644 vtex/server/generated/b2b-password-migration-protocol/index.ts create mode 100644 vtex/server/generated/b2b-password-migration-protocol/sdk.gen.ts create mode 100644 vtex/server/generated/b2b-password-migration-protocol/types.gen.ts create mode 100644 vtex/server/generated/b2b-password-migration-protocol/zod.gen.ts create mode 100644 vtex/server/generated/bulk-pricing/client.gen.ts create mode 100644 vtex/server/generated/bulk-pricing/client/client.gen.ts create mode 100644 vtex/server/generated/bulk-pricing/client/index.ts create mode 100644 vtex/server/generated/bulk-pricing/client/types.gen.ts create mode 100644 vtex/server/generated/bulk-pricing/client/utils.gen.ts create mode 100644 vtex/server/generated/bulk-pricing/core/auth.gen.ts create mode 100644 vtex/server/generated/bulk-pricing/core/bodySerializer.gen.ts create mode 100644 vtex/server/generated/bulk-pricing/core/params.gen.ts create mode 100644 vtex/server/generated/bulk-pricing/core/pathSerializer.gen.ts create mode 100644 vtex/server/generated/bulk-pricing/core/queryKeySerializer.gen.ts create mode 100644 vtex/server/generated/bulk-pricing/core/serverSentEvents.gen.ts create mode 100644 vtex/server/generated/bulk-pricing/core/types.gen.ts create mode 100644 vtex/server/generated/bulk-pricing/core/utils.gen.ts create mode 100644 vtex/server/generated/bulk-pricing/index.ts create mode 100644 vtex/server/generated/bulk-pricing/sdk.gen.ts create mode 100644 vtex/server/generated/bulk-pricing/types.gen.ts create mode 100644 vtex/server/generated/bulk-pricing/zod.gen.ts create mode 100644 vtex/server/generated/delivery-promise-suggestions/client.gen.ts create mode 100644 vtex/server/generated/delivery-promise-suggestions/client/client.gen.ts create mode 100644 vtex/server/generated/delivery-promise-suggestions/client/index.ts create mode 100644 vtex/server/generated/delivery-promise-suggestions/client/types.gen.ts create mode 100644 vtex/server/generated/delivery-promise-suggestions/client/utils.gen.ts create mode 100644 vtex/server/generated/delivery-promise-suggestions/core/auth.gen.ts create mode 100644 vtex/server/generated/delivery-promise-suggestions/core/bodySerializer.gen.ts create mode 100644 vtex/server/generated/delivery-promise-suggestions/core/params.gen.ts create mode 100644 vtex/server/generated/delivery-promise-suggestions/core/pathSerializer.gen.ts create mode 100644 vtex/server/generated/delivery-promise-suggestions/core/queryKeySerializer.gen.ts create mode 100644 vtex/server/generated/delivery-promise-suggestions/core/serverSentEvents.gen.ts create mode 100644 vtex/server/generated/delivery-promise-suggestions/core/types.gen.ts create mode 100644 vtex/server/generated/delivery-promise-suggestions/core/utils.gen.ts create mode 100644 vtex/server/generated/delivery-promise-suggestions/index.ts create mode 100644 vtex/server/generated/delivery-promise-suggestions/sdk.gen.ts create mode 100644 vtex/server/generated/delivery-promise-suggestions/types.gen.ts create mode 100644 vtex/server/generated/delivery-promise-suggestions/zod.gen.ts create mode 100644 vtex/server/generated/external-promotions-protocol/client.gen.ts create mode 100644 vtex/server/generated/external-promotions-protocol/client/client.gen.ts create mode 100644 vtex/server/generated/external-promotions-protocol/client/index.ts create mode 100644 vtex/server/generated/external-promotions-protocol/client/types.gen.ts create mode 100644 vtex/server/generated/external-promotions-protocol/client/utils.gen.ts create mode 100644 vtex/server/generated/external-promotions-protocol/core/auth.gen.ts create mode 100644 vtex/server/generated/external-promotions-protocol/core/bodySerializer.gen.ts create mode 100644 vtex/server/generated/external-promotions-protocol/core/params.gen.ts create mode 100644 vtex/server/generated/external-promotions-protocol/core/pathSerializer.gen.ts create mode 100644 vtex/server/generated/external-promotions-protocol/core/queryKeySerializer.gen.ts create mode 100644 vtex/server/generated/external-promotions-protocol/core/serverSentEvents.gen.ts create mode 100644 vtex/server/generated/external-promotions-protocol/core/types.gen.ts create mode 100644 vtex/server/generated/external-promotions-protocol/core/utils.gen.ts create mode 100644 vtex/server/generated/external-promotions-protocol/index.ts create mode 100644 vtex/server/generated/external-promotions-protocol/sdk.gen.ts create mode 100644 vtex/server/generated/external-promotions-protocol/types.gen.ts create mode 100644 vtex/server/generated/external-promotions-protocol/zod.gen.ts create mode 100644 vtex/server/generated/intelligent-search-api-v1/client.gen.ts create mode 100644 vtex/server/generated/intelligent-search-api-v1/client/client.gen.ts create mode 100644 vtex/server/generated/intelligent-search-api-v1/client/index.ts create mode 100644 vtex/server/generated/intelligent-search-api-v1/client/types.gen.ts create mode 100644 vtex/server/generated/intelligent-search-api-v1/client/utils.gen.ts create mode 100644 vtex/server/generated/intelligent-search-api-v1/core/auth.gen.ts create mode 100644 vtex/server/generated/intelligent-search-api-v1/core/bodySerializer.gen.ts create mode 100644 vtex/server/generated/intelligent-search-api-v1/core/params.gen.ts create mode 100644 vtex/server/generated/intelligent-search-api-v1/core/pathSerializer.gen.ts create mode 100644 vtex/server/generated/intelligent-search-api-v1/core/queryKeySerializer.gen.ts create mode 100644 vtex/server/generated/intelligent-search-api-v1/core/serverSentEvents.gen.ts create mode 100644 vtex/server/generated/intelligent-search-api-v1/core/types.gen.ts create mode 100644 vtex/server/generated/intelligent-search-api-v1/core/utils.gen.ts create mode 100644 vtex/server/generated/intelligent-search-api-v1/index.ts create mode 100644 vtex/server/generated/intelligent-search-api-v1/sdk.gen.ts create mode 100644 vtex/server/generated/intelligent-search-api-v1/types.gen.ts create mode 100644 vtex/server/generated/intelligent-search-api-v1/zod.gen.ts create mode 100644 vtex/server/generated/payment-policies/client.gen.ts create mode 100644 vtex/server/generated/payment-policies/client/client.gen.ts create mode 100644 vtex/server/generated/payment-policies/client/index.ts create mode 100644 vtex/server/generated/payment-policies/client/types.gen.ts create mode 100644 vtex/server/generated/payment-policies/client/utils.gen.ts create mode 100644 vtex/server/generated/payment-policies/core/auth.gen.ts create mode 100644 vtex/server/generated/payment-policies/core/bodySerializer.gen.ts create mode 100644 vtex/server/generated/payment-policies/core/params.gen.ts create mode 100644 vtex/server/generated/payment-policies/core/pathSerializer.gen.ts create mode 100644 vtex/server/generated/payment-policies/core/queryKeySerializer.gen.ts create mode 100644 vtex/server/generated/payment-policies/core/serverSentEvents.gen.ts create mode 100644 vtex/server/generated/payment-policies/core/types.gen.ts create mode 100644 vtex/server/generated/payment-policies/core/utils.gen.ts create mode 100644 vtex/server/generated/payment-policies/index.ts create mode 100644 vtex/server/generated/payment-policies/sdk.gen.ts create mode 100644 vtex/server/generated/payment-policies/types.gen.ts create mode 100644 vtex/server/generated/payment-policies/zod.gen.ts create mode 100644 vtex/server/generated/shopee-integration/client.gen.ts create mode 100644 vtex/server/generated/shopee-integration/client/client.gen.ts create mode 100644 vtex/server/generated/shopee-integration/client/index.ts create mode 100644 vtex/server/generated/shopee-integration/client/types.gen.ts create mode 100644 vtex/server/generated/shopee-integration/client/utils.gen.ts create mode 100644 vtex/server/generated/shopee-integration/core/auth.gen.ts create mode 100644 vtex/server/generated/shopee-integration/core/bodySerializer.gen.ts create mode 100644 vtex/server/generated/shopee-integration/core/params.gen.ts create mode 100644 vtex/server/generated/shopee-integration/core/pathSerializer.gen.ts create mode 100644 vtex/server/generated/shopee-integration/core/queryKeySerializer.gen.ts create mode 100644 vtex/server/generated/shopee-integration/core/serverSentEvents.gen.ts create mode 100644 vtex/server/generated/shopee-integration/core/types.gen.ts create mode 100644 vtex/server/generated/shopee-integration/core/utils.gen.ts create mode 100644 vtex/server/generated/shopee-integration/index.ts create mode 100644 vtex/server/generated/shopee-integration/sdk.gen.ts create mode 100644 vtex/server/generated/shopee-integration/types.gen.ts create mode 100644 vtex/server/generated/shopee-integration/zod.gen.ts create mode 100644 vtex/server/generated/user-rights/client.gen.ts create mode 100644 vtex/server/generated/user-rights/client/client.gen.ts create mode 100644 vtex/server/generated/user-rights/client/index.ts create mode 100644 vtex/server/generated/user-rights/client/types.gen.ts create mode 100644 vtex/server/generated/user-rights/client/utils.gen.ts create mode 100644 vtex/server/generated/user-rights/core/auth.gen.ts create mode 100644 vtex/server/generated/user-rights/core/bodySerializer.gen.ts create mode 100644 vtex/server/generated/user-rights/core/params.gen.ts create mode 100644 vtex/server/generated/user-rights/core/pathSerializer.gen.ts create mode 100644 vtex/server/generated/user-rights/core/queryKeySerializer.gen.ts create mode 100644 vtex/server/generated/user-rights/core/serverSentEvents.gen.ts create mode 100644 vtex/server/generated/user-rights/core/types.gen.ts create mode 100644 vtex/server/generated/user-rights/core/utils.gen.ts create mode 100644 vtex/server/generated/user-rights/index.ts create mode 100644 vtex/server/generated/user-rights/sdk.gen.ts create mode 100644 vtex/server/generated/user-rights/types.gen.ts create mode 100644 vtex/server/generated/user-rights/zod.gen.ts diff --git a/vtex/server/generated/ads/index.ts b/vtex/server/generated/ads/index.ts index 3b2b13c6..5f717e53 100644 --- a/vtex/server/generated/ads/index.ts +++ b/vtex/server/generated/ads/index.ts @@ -1,4 +1,4 @@ // This file is auto-generated by @hey-api/openapi-ts -export { type Options, postProductBulkInventories, postProductBulkProducts, postV1BeaconClickByAdId, postV1BeaconConversion, postV1BeaconImpressionByAdId, postV1BeaconViewByAdId, postV1RmaByPublisherId } from './sdk.gen'; -export type { Accept, ClientOptions, ContentType, PostProductBulkInventoriesData, PostProductBulkInventoriesError, PostProductBulkInventoriesErrors, PostProductBulkInventoriesResponse, PostProductBulkInventoriesResponses, PostProductBulkProductsData, PostProductBulkProductsError, PostProductBulkProductsErrors, PostProductBulkProductsResponse, PostProductBulkProductsResponses, PostV1BeaconClickByAdIdData, PostV1BeaconClickByAdIdError, PostV1BeaconClickByAdIdErrors, PostV1BeaconClickByAdIdResponse, PostV1BeaconClickByAdIdResponses, PostV1BeaconConversionData, PostV1BeaconConversionError, PostV1BeaconConversionErrors, PostV1BeaconConversionResponse, PostV1BeaconConversionResponses, PostV1BeaconImpressionByAdIdData, PostV1BeaconImpressionByAdIdError, PostV1BeaconImpressionByAdIdErrors, PostV1BeaconImpressionByAdIdResponse, PostV1BeaconImpressionByAdIdResponses, PostV1BeaconViewByAdIdData, PostV1BeaconViewByAdIdError, PostV1BeaconViewByAdIdErrors, PostV1BeaconViewByAdIdResponse, PostV1BeaconViewByAdIdResponses, PostV1RmaByPublisherIdData, PostV1RmaByPublisherIdError, PostV1RmaByPublisherIdErrors, PostV1RmaByPublisherIdResponse, PostV1RmaByPublisherIdResponses } from './types.gen'; +export { getAdResultsV2, getCampaignByCampaignId, getCampaignV2, getReportAdvertisersAdsDetailed, getReportAdvertisersCampaignsDetailed, getReportNetworkPublishers, getReportV2Advertisers, getReportV2Publishers, type Options, postAudienceUploadUrl, postProductBulkInventories, postProductBulkProducts, postSsoMarketplace, postV1BeaconClickByAdId, postV1BeaconConversion, postV1BeaconImpressionByAdId, postV1BeaconViewByAdId, postV1RmaByPublisherId, postWebhookMarketplaceTransfersByPublisherId } from './sdk.gen'; +export type { Accept, AccountInfo, ClientOptions, ContentType, Count, Download, EndDate, GetAdResultsV2Data, GetAdResultsV2Errors, GetAdResultsV2Response, GetAdResultsV2Responses, GetCampaignByCampaignIdData, GetCampaignByCampaignIdErrors, GetCampaignByCampaignIdResponse, GetCampaignByCampaignIdResponses, GetCampaignV2Data, GetCampaignV2Errors, GetCampaignV2Response, GetCampaignV2Responses, GetReportAdvertisersAdsDetailedData, GetReportAdvertisersAdsDetailedErrors, GetReportAdvertisersAdsDetailedResponse, GetReportAdvertisersAdsDetailedResponses, GetReportAdvertisersCampaignsDetailedData, GetReportAdvertisersCampaignsDetailedErrors, GetReportAdvertisersCampaignsDetailedResponse, GetReportAdvertisersCampaignsDetailedResponses, GetReportNetworkPublishersData, GetReportNetworkPublishersErrors, GetReportNetworkPublishersResponse, GetReportNetworkPublishersResponses, GetReportV2AdvertisersData, GetReportV2AdvertisersErrors, GetReportV2AdvertisersResponse, GetReportV2AdvertisersResponses, GetReportV2PublishersData, GetReportV2PublishersErrors, GetReportV2PublishersResponse, GetReportV2PublishersResponses, OrderDirection, Page, PostAudienceUploadUrlData, PostAudienceUploadUrlErrors, PostAudienceUploadUrlResponse, PostAudienceUploadUrlResponses, PostProductBulkInventoriesData, PostProductBulkInventoriesErrors, PostProductBulkInventoriesResponse, PostProductBulkInventoriesResponses, PostProductBulkProductsData, PostProductBulkProductsErrors, PostProductBulkProductsResponse, PostProductBulkProductsResponses, PostSsoMarketplaceData, PostSsoMarketplaceErrors, PostSsoMarketplaceResponse, PostSsoMarketplaceResponses, PostV1BeaconClickByAdIdData, PostV1BeaconClickByAdIdErrors, PostV1BeaconClickByAdIdResponse, PostV1BeaconClickByAdIdResponses, PostV1BeaconConversionData, PostV1BeaconConversionErrors, PostV1BeaconConversionResponse, PostV1BeaconConversionResponses, PostV1BeaconImpressionByAdIdData, PostV1BeaconImpressionByAdIdErrors, PostV1BeaconImpressionByAdIdResponse, PostV1BeaconImpressionByAdIdResponses, PostV1BeaconViewByAdIdData, PostV1BeaconViewByAdIdErrors, PostV1BeaconViewByAdIdResponse, PostV1BeaconViewByAdIdResponses, PostV1RmaByPublisherIdData, PostV1RmaByPublisherIdErrors, PostV1RmaByPublisherIdResponse, PostV1RmaByPublisherIdResponses, PostWebhookMarketplaceTransfersByPublisherIdData, PostWebhookMarketplaceTransfersByPublisherIdErrors, PostWebhookMarketplaceTransfersByPublisherIdResponse, PostWebhookMarketplaceTransfersByPublisherIdResponses, Quantity, StartDate } from './types.gen'; diff --git a/vtex/server/generated/ads/sdk.gen.ts b/vtex/server/generated/ads/sdk.gen.ts index 0b27287b..296815f0 100644 --- a/vtex/server/generated/ads/sdk.gen.ts +++ b/vtex/server/generated/ads/sdk.gen.ts @@ -2,7 +2,7 @@ import type { Client, Options as Options2, TDataShape } from './client'; import { client } from './client.gen'; -import type { PostProductBulkInventoriesData, PostProductBulkInventoriesErrors, PostProductBulkInventoriesResponses, PostProductBulkProductsData, PostProductBulkProductsErrors, PostProductBulkProductsResponses, PostV1BeaconClickByAdIdData, PostV1BeaconClickByAdIdErrors, PostV1BeaconClickByAdIdResponses, PostV1BeaconConversionData, PostV1BeaconConversionErrors, PostV1BeaconConversionResponses, PostV1BeaconImpressionByAdIdData, PostV1BeaconImpressionByAdIdErrors, PostV1BeaconImpressionByAdIdResponses, PostV1BeaconViewByAdIdData, PostV1BeaconViewByAdIdErrors, PostV1BeaconViewByAdIdResponses, PostV1RmaByPublisherIdData, PostV1RmaByPublisherIdErrors, PostV1RmaByPublisherIdResponses } from './types.gen'; +import type { GetAdResultsV2Data, GetAdResultsV2Errors, GetAdResultsV2Responses, GetCampaignByCampaignIdData, GetCampaignByCampaignIdErrors, GetCampaignByCampaignIdResponses, GetCampaignV2Data, GetCampaignV2Errors, GetCampaignV2Responses, GetReportAdvertisersAdsDetailedData, GetReportAdvertisersAdsDetailedErrors, GetReportAdvertisersAdsDetailedResponses, GetReportAdvertisersCampaignsDetailedData, GetReportAdvertisersCampaignsDetailedErrors, GetReportAdvertisersCampaignsDetailedResponses, GetReportNetworkPublishersData, GetReportNetworkPublishersErrors, GetReportNetworkPublishersResponses, GetReportV2AdvertisersData, GetReportV2AdvertisersErrors, GetReportV2AdvertisersResponses, GetReportV2PublishersData, GetReportV2PublishersErrors, GetReportV2PublishersResponses, PostAudienceUploadUrlData, PostAudienceUploadUrlErrors, PostAudienceUploadUrlResponses, PostProductBulkInventoriesData, PostProductBulkInventoriesErrors, PostProductBulkInventoriesResponses, PostProductBulkProductsData, PostProductBulkProductsErrors, PostProductBulkProductsResponses, PostSsoMarketplaceData, PostSsoMarketplaceErrors, PostSsoMarketplaceResponses, PostV1BeaconClickByAdIdData, PostV1BeaconClickByAdIdErrors, PostV1BeaconClickByAdIdResponses, PostV1BeaconConversionData, PostV1BeaconConversionErrors, PostV1BeaconConversionResponses, PostV1BeaconImpressionByAdIdData, PostV1BeaconImpressionByAdIdErrors, PostV1BeaconImpressionByAdIdResponses, PostV1BeaconViewByAdIdData, PostV1BeaconViewByAdIdErrors, PostV1BeaconViewByAdIdResponses, PostV1RmaByPublisherIdData, PostV1RmaByPublisherIdErrors, PostV1RmaByPublisherIdResponses, PostWebhookMarketplaceTransfersByPublisherIdData, PostWebhookMarketplaceTransfersByPublisherIdErrors, PostWebhookMarketplaceTransfersByPublisherIdResponses } from './types.gen'; export type Options = Options2 & { /** @@ -21,13 +21,13 @@ export type Options⚠️ For each batch insert/update, a maximum of 500 objects per request and 3 simultaneous requests are allowed. * * ## Permissions * - * This endpoint does not require [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3). + * This endpoint does not require [License Manager resources](https://help.vtex.com/docs/tutorials/license-manager-resources). */ export const postProductBulkProducts = (options: Options) => (options.client ?? client).post({ security: [{ name: 'X-App-Id', type: 'apiKey' }, { name: 'X-Api-Key', type: 'apiKey' }], @@ -40,11 +40,11 @@ export const postProductBulkProducts = (op * * Update inventory information, which defines the price, promotional price, and product availability. * - * >⚠️ For each batch insert/update, a maximum of 500 objects per request and 3 simultaneous requests are allowed. + * >⚠️ For each batch insert/update, a maximum of 500 objects per request and three simultaneous requests are allowed. * * ## Permissions * - * This endpoint does not require [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3). + * This endpoint does not require [License Manager resources](https://help.vtex.com/docs/tutorials/license-manager-resources). */ export const postProductBulkInventories = (options: Options) => (options.client ?? client).post({ security: [{ name: 'X-App-Id', type: 'apiKey' }, { name: 'X-Api-Key', type: 'apiKey' }], @@ -55,11 +55,13 @@ export const postProductBulkInventories = /** * Track ad impressions * - * Track when an ad is rendered or visible to a user. The event URL must not be constructed manually — always use the URL provided from `POST` [Get ads](https://developers.vtex.com/docs/api-reference/vtex-ads-api#post-/v1/rma/-publisher_id-). + * Track when an ad is rendered on a page. An impression does not determine whether the ad became visible to the user. Visibility is tracked by the separate `view` event. Do not construct the event URL manually. Always use the URL provided from `POST` [Get ads](https://developers.vtex.com/docs/api-reference/vtex-ads-api#post-/v1/rma/-publisher_id-). + * + * >ℹ️ Fire this event whenever a page loads that contains rendered ads. * * ## Permissions * - * This endpoint does not require [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3). + * This endpoint does not require [License Manager resources](https://help.vtex.com/docs/tutorials/license-manager-resources). */ export const postV1BeaconImpressionByAdId = (options: Options) => (options.client ?? client).post({ security: [{ name: 'X-App-Id', type: 'apiKey' }, { name: 'X-Api-Key', type: 'apiKey' }], @@ -74,7 +76,7 @@ export const postV1BeaconImpressionByAdId = (options: Options) => (options.client ?? client).post({ security: [{ name: 'X-App-Id', type: 'apiKey' }, { name: 'X-Api-Key', type: 'apiKey' }], @@ -85,11 +87,13 @@ export const postV1BeaconClickByAdId = (op /** * Track ad views * - * Track views for banner ads. The event URL must not be constructed manually — always use the URL provided from `POST` [Get ads](https://developers.vtex.com/docs/api-reference/vtex-ads-api#post-/v1/rma/-publisher_id-). + * Track when an ad becomes visible to the user. Do not construct the event URL manually. Always use the URL provided from `POST` [Get ads](https://developers.vtex.com/docs/api-reference/vtex-ads-api#post-/v1/rma/-publisher_id-). + * + * >ℹ️ Fire this event when the ad occupies at least 50% of the viewport for at least 1 second. * * ## Permissions * - * This endpoint does not require [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3). + * This endpoint does not require [License Manager resources](https://help.vtex.com/docs/tutorials/license-manager-resources). */ export const postV1BeaconViewByAdId = (options: Options) => (options.client ?? client).post({ security: [{ name: 'X-App-Id', type: 'apiKey' }, { name: 'X-Api-Key', type: 'apiKey' }], @@ -100,11 +104,11 @@ export const postV1BeaconViewByAdId = (opt /** * Track conversions * - * Track when an ad leads to a purchase. This endpoint is used to notify one or more orders (sending them in a batch). + * Track completed sales for conversion attribution. Send this event for every completed sale, regardless of whether an ad led to the purchase. Notifying all sales enables attribution within time windows after ad-impacted navigation and metrics such as assisted sales. Send one or more orders in a batch request. * * ## Permissions * - * This endpoint does not require [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3). + * This endpoint does not require [License Manager resources](https://help.vtex.com/docs/tutorials/license-manager-resources). */ export const postV1BeaconConversion = (options: Options) => (options.client ?? client).post({ security: [{ name: 'X-App-Id', type: 'apiKey' }, { name: 'X-Api-Key', type: 'apiKey' }], @@ -119,15 +123,211 @@ export const postV1BeaconConversion = (opt * * ## Permissions * - * This endpoint does not require [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3). + * This endpoint does not require [License Manager resources](https://help.vtex.com/docs/tutorials/license-manager-resources). * * ## Request best practices * * - **HTTP persistence:** Prefer persistent connections (`Connection: keep-alive`). - * - **Timeout:** Apply a 500–600 ms timeout to the ad query. + * - **Timeout:** Apply a 500-600 ms timeout to the ad query. + * + * ## Context-specific fields + * + * The `context` value determines which additional fields are required in the request body. The example below uses the `search` context — adapt it to your context using the table below. Include only the fields listed for your context (in addition to the common required fields `session_id`, `context`, `channel`, and `placements`). + * + * | `context` | Additional required fields | Notes | + * | --- | --- | --- | + * | `home` | None | Use generic placements (top banner, home shelf). | + * | `category` | `category_name` | Provide the full breadcrumb path (for example, `Daily Care > Deodorant > Spray`). | + * | `search` | `term` | Send the search query. Optionally pass `tags` to scope eligible ads. | + * | `product_page` | `product_sku` | SKU of the product currently being viewed. | + * | `brand_page` | `brand_name` | Name of the brand. Pair with `sponsored_brand` placements when applicable. | + * | `digital_signage` | `device_id`, `store_name` | Use `digital_signage` placements and the `app` channel. | */ export const postV1RmaByPublisherId = (options: Options) => (options.client ?? client).post({ security: [{ name: 'X-App-Id', type: 'apiKey' }, { name: 'X-Api-Key', type: 'apiKey' }], url: '/v1/rma/{publisher_id}', ...options }); + +/** + * Get advertisers report + * + * Retrieves information from all advertisers associated with a publisher account. The data is returned in JSON format by default, but can be exported as an XLSX file by setting `download=true`. + * + * >ℹ️ Only available in the publisher view (publisher account). + * + * ## Permissions + * + * This endpoint does not require [License Manager resources](https://help.vtex.com/docs/tutorials/license-manager-resources). + */ +export const getReportV2Advertisers = (options: Options) => (options.client ?? client).get({ + security: [{ name: 'X-App-Id', type: 'apiKey' }, { name: 'X-Api-Key', type: 'apiKey' }], + url: '/report/v2/advertisers', + ...options +}); + +/** + * Get publishers report + * + * Retrieves information about the publishers associated with an advertiser account. The data is returned in JSON format by default, but can be exported as an XLSX file by setting `download=true`. + * + * >ℹ️ Only available in the advertiser view (advertiser account). + * + * ## Permissions + * + * This endpoint does not require [License Manager resources](https://help.vtex.com/docs/tutorials/license-manager-resources). + */ +export const getReportV2Publishers = (options: Options) => (options.client ?? client).get({ + security: [{ name: 'X-App-Id', type: 'apiKey' }, { name: 'X-Api-Key', type: 'apiKey' }], + url: '/report/v2/publishers', + ...options +}); + +/** + * Get network publishers report + * + * Retrieves information about publishers associated with a Network Publisher account. The data is returned in JSON format by default, but can be exported as an XLSX file by setting `download=true`. + * + * >ℹ️ Only publishers operating in the Network format are allowed to access this report. + * + * ## Permissions + * + * This endpoint does not require [License Manager resources](https://help.vtex.com/docs/tutorials/license-manager-resources). + */ +export const getReportNetworkPublishers = (options: Options) => (options.client ?? client).get({ + security: [{ name: 'X-App-Id', type: 'apiKey' }, { name: 'X-Api-Key', type: 'apiKey' }], + url: '/report/network/publishers', + ...options +}); + +/** + * List campaigns + * + * Fetches all available campaigns, applying filters as needed. The data is returned in JSON format by default, but can be exported as an XLSX file by setting `download=true`. + * + * ## Permissions + * + * This endpoint does not require [License Manager resources](https://help.vtex.com/docs/tutorials/license-manager-resources). + */ +export const getCampaignV2 = (options: Options) => (options.client ?? client).get({ + security: [{ name: 'X-App-Id', type: 'apiKey' }, { name: 'X-Api-Key', type: 'apiKey' }], + url: '/campaign/v2', + ...options +}); + +/** + * Get campaign details + * + * Retrieves detailed information about a campaign, such as the products associated with the campaign, status history, ads, and metrics. The data is returned only in JSON format. + * + * ## Permissions + * + * This endpoint does not require [License Manager resources](https://help.vtex.com/docs/tutorials/license-manager-resources). + */ +export const getCampaignByCampaignId = (options: Options) => (options.client ?? client).get({ + security: [{ name: 'X-App-Id', type: 'apiKey' }, { name: 'X-Api-Key', type: 'apiKey' }], + url: '/campaign/{campaign_id}', + ...options +}); + +/** + * Get advertiser campaigns detailed report + * + * Exports a mixed campaign report for advertiser accounts, including both regular campaigns and subpublisher information for network campaigns. The data is returned in JSON format by default, but can be exported as an XLSX file by setting `download=true`. + * + * >ℹ️ This route is intended for advertiser accounts. For non white-label accounts, only non-private publisher rows are returned. + * + * ## Permissions + * + * This endpoint does not require [License Manager resources](https://help.vtex.com/docs/tutorials/license-manager-resources). + */ +export const getReportAdvertisersCampaignsDetailed = (options: Options) => (options.client ?? client).get({ + security: [{ name: 'X-App-Id', type: 'apiKey' }, { name: 'X-Api-Key', type: 'apiKey' }], + url: '/report/advertisers/campaigns-detailed', + ...options +}); + +/** + * Get advertiser ads detailed report + * + * Exports a detailed ad report for advertiser accounts, including subpublisher breakdown for network campaigns. The data is returned in JSON format by default, but can be exported as an XLSX file by setting `download=true`. + * + * >ℹ️ This route is intended for advertiser accounts. Non-network campaigns return one row per ad, while network campaigns return one row per `ad + subpublisher`. For non white-label accounts, only non-private publisher rows are returned. + * + * ## Permissions + * + * This endpoint does not require [License Manager resources](https://help.vtex.com/docs/tutorials/license-manager-resources). + */ +export const getReportAdvertisersAdsDetailed = (options: Options) => (options.client ?? client).get({ + security: [{ name: 'X-App-Id', type: 'apiKey' }, { name: 'X-Api-Key', type: 'apiKey' }], + url: '/report/advertisers/ads-detailed', + ...options +}); + +/** + * Get ads performance report + * + * Fetches all available ads, applying filters as needed. The data is returned in JSON format by default, but can be exported as an XLSX file by setting `download=true`. + * + * >ℹ️ Paused ads are excluded from the default response. To include paused ads, set `show_inactive=true`. + * + * ## Permissions + * + * This endpoint does not require [License Manager resources](https://help.vtex.com/docs/tutorials/license-manager-resources). + */ +export const getAdResultsV2 = (options: Options) => (options.client ?? client).get({ + security: [{ name: 'X-App-Id', type: 'apiKey' }, { name: 'X-Api-Key', type: 'apiKey' }], + url: '/ad/results/v2', + ...options +}); + +/** + * Notify credit transfer status + * + * Notifies VTEX Ads about the final status of a credit transfer that was previously requested by VTEX Ads to the marketplace's `POST /checking_account/transfer` endpoint. The marketplace must call this webhook with the resolved status of each transfer transaction. + * + * >⚠️ In case of a webhook call failure, the marketplace must retry until a `204 No Content` response is received. + * + * ## Permissions + * + * This endpoint does not require [License Manager resources](https://help.vtex.com/docs/tutorials/license-manager-resources). + */ +export const postWebhookMarketplaceTransfersByPublisherId = (options: Options) => (options.client ?? client).post({ + security: [{ name: 'X-Api-Key', type: 'apiKey' }, { name: 'X-Secret-Key', type: 'apiKey' }], + url: '/webhook/marketplace/transfers/{publisher_id}', + ...options +}); + +/** + * Generate audience upload URL + * + * Returns a short-lived pre-signed Amazon S3 `POST` that lets a publisher upload an audience file without long-lived credentials. The response carries the destination `url` and the signed `fields` that must accompany the upload. + * + * The backend builds the object `key` from the authenticated publisher, so a publisher cannot write to another publisher's path. The pre-signed `POST` is valid for `expires_in` seconds (900 by default) and Amazon S3 rejects files larger than `max_bytes` (2 GiB by default). + * + * >ℹ️ The file upload itself is a separate multipart `POST` request sent directly to Amazon S3 with the returned `url` and `fields`. It is not part of this API. See [Integrating audiences](https://developers.vtex.com/docs/guides/integrating-audiences) for the full flow, file format, and PII hashing rules. + * + * ## Permissions + * + * This endpoint does not require [License Manager resources](https://help.vtex.com/docs/tutorials/license-manager-resources). + */ +export const postAudienceUploadUrl = (options: Options) => (options.client ?? client).post({ + security: [{ name: 'X-App-Id', type: 'apiKey' }, { name: 'X-Api-Key', type: 'apiKey' }], + url: '/audience/upload-url', + ...options +}); + +/** + * Generate seller single sign-on URL + * + * Generates a redirect URL that allows a seller user to access the VTEX Ads platform without needing to log in again. Use this endpoint to enable a unified login experience for marketplace sellers. + * + * ## Permissions + * + * This endpoint does not require [License Manager resources](https://help.vtex.com/docs/tutorials/license-manager-resources). + */ +export const postSsoMarketplace = (options: Options) => (options.client ?? client).post({ + security: [{ name: 'X-App-Id', type: 'apiKey' }, { name: 'X-Api-Key', type: 'apiKey' }], + url: '/sso/marketplace', + ...options +}); diff --git a/vtex/server/generated/ads/types.gen.ts b/vtex/server/generated/ads/types.gen.ts index 41e536bf..61573740 100644 --- a/vtex/server/generated/ads/types.gen.ts +++ b/vtex/server/generated/ads/types.gen.ts @@ -1,7 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts export type ClientOptions = { - baseUrl: 'https://api-retail-media.newtail.com.br' | 'https://events.newtail-media.newtail.com.br' | 'https://api.ads.vtex.com' | 'https://api.ads.vtex.com' | 'https://events-api.ads.vtex.com' | 'https://events-api.ads.vtex.com' | 'https://events-api.ads.vtex.com' | 'https://events-api.ads.vtex.com' | 'https://api.ads.vtex.com' | (string & {}); + baseUrl: 'https://api-retail-media.newtail.com.br' | 'https://newtail-media.newtail.com.br' | 'https://events.newtail-media.newtail.com.br' | 'https://api-retail-media.newtail.com.br' | 'https://api-retail-media.newtail.com.br' | 'https://events.newtail-media.newtail.com.br' | 'https://events.newtail-media.newtail.com.br' | 'https://events.newtail-media.newtail.com.br' | 'https://events.newtail-media.newtail.com.br' | 'https://newtail-media.newtail.com.br' | 'https://api-retail-media.newtail.com.br' | 'https://api-retail-media.newtail.com.br' | 'https://api-retail-media.newtail.com.br' | 'https://api-retail-media.newtail.com.br' | 'https://api-retail-media.newtail.com.br' | 'https://api-retail-media.newtail.com.br' | 'https://api-retail-media.newtail.com.br' | 'https://api-retail-media.newtail.com.br' | 'https://api-retail-media.newtail.com.br' | 'https://api-retail-media.newtail.com.br' | 'https://api-retail-media.newtail.com.br' | (string & {}); }; /** @@ -14,6 +14,46 @@ export type ContentType = string; */ export type Accept = string; +/** + * Start date for metrics in `YYYY-MM-DD` format. + */ +export type StartDate = string; + +/** + * End date for metrics in `YYYY-MM-DD` format. + */ +export type EndDate = string; + +/** + * Page number of the results. + */ +export type Page = number; + +/** + * Number of items per page. When `download=true`, the BFF requests up to `20000` rows for XLSX generation. + */ +export type Quantity = number; + +/** + * If `true`, returns the total number of available records. + */ +export type Count = boolean; + +/** + * If `true`, includes detailed account information in the result. + */ +export type AccountInfo = boolean; + +/** + * If `true`, returns an XLSX file buffer for download instead of JSON. + */ +export type Download = boolean; + +/** + * Sort direction. + */ +export type OrderDirection = 'asc' | 'desc'; + export type PostProductBulkProductsData = { body?: Array<{ /** @@ -80,39 +120,14 @@ export type PostProductBulkProductsData = { export type PostProductBulkProductsErrors = { /** - * Field validation error list. + * Validation Error */ - 422: Array<{ - /** - * Path to the property with the error. - */ - instancePath?: string; - /** - * Path to the schema validation rule. - */ - schemaPath?: string; - /** - * Validation keyword. - */ - keyword?: string; - /** - * Error parameters. - */ - params?: { - [key: string]: unknown; - }; - /** - * Error message. - */ - message?: string; - }>; + 422: unknown; }; -export type PostProductBulkProductsError = PostProductBulkProductsErrors[keyof PostProductBulkProductsErrors]; - export type PostProductBulkProductsResponses = { /** - * Object with messages from the server. + * Accepted */ 202: { /** @@ -125,9 +140,6 @@ export type PostProductBulkProductsResponses = { export type PostProductBulkProductsResponse = PostProductBulkProductsResponses[keyof PostProductBulkProductsResponses]; export type PostProductBulkInventoriesData = { - /** - * List of inventory objects. - */ body?: Array<{ /** * Product ID to be inserted/updated. @@ -149,6 +161,12 @@ export type PostProductBulkInventoriesData = { * Indicates if the product is available for sale. */ is_available: boolean; + /** + * Additional inventory information. + */ + metadata?: { + [key: string]: unknown; + }; }>; headers: { /** @@ -167,39 +185,14 @@ export type PostProductBulkInventoriesData = { export type PostProductBulkInventoriesErrors = { /** - * Field validation error list. + * Validation Error */ - 422: Array<{ - /** - * Path to the property with the error. - */ - instancePath?: string; - /** - * Path to the schema validation rule. - */ - schemaPath?: string; - /** - * Validation keyword. - */ - keyword?: string; - /** - * Error parameters. - */ - params?: { - [key: string]: unknown; - }; - /** - * Error message. - */ - message?: string; - }>; + 422: unknown; }; -export type PostProductBulkInventoriesError = PostProductBulkInventoriesErrors[keyof PostProductBulkInventoriesErrors]; - export type PostProductBulkInventoriesResponses = { /** - * Object with messages from the server. + * Accepted */ 202: { /** @@ -212,15 +205,19 @@ export type PostProductBulkInventoriesResponses = { export type PostProductBulkInventoriesResponse = PostProductBulkInventoriesResponses[keyof PostProductBulkInventoriesResponses]; export type PostV1BeaconImpressionByAdIdData = { - body?: { + body?: ({ + [key: string]: unknown; + } | { + [key: string]: unknown; + }) & { /** - * Unique identifier for the user within your platform. It must remain consistent across all user touchpoints and sales channels. + * Unique identifier for the user within your platform. It must remain consistent across all user touchpoints and sales channels. Required when `session_id` is not provided. */ user_id?: string; /** - * The user's session identifier. It has a limited lifespan and helps determine when a user transitions from anonymous to identified state. + * Persistent visitor identifier. Must remain stable for at least 14 days. For mobile apps, use the device ID (GAID on Android, IDFA on iOS). Required when `user_id` is not provided. */ - session_id: string; + session_id?: string; }; headers: { /** @@ -249,39 +246,14 @@ export type PostV1BeaconImpressionByAdIdData = { export type PostV1BeaconImpressionByAdIdErrors = { /** - * Field validation error list. + * Validation Error */ - 422: Array<{ - /** - * Path to the property with the error. - */ - instancePath?: string; - /** - * Validation keyword. - */ - keyword?: string; - /** - * Error message. - */ - message?: string; - /** - * Error parameters. - */ - params?: { - [key: string]: unknown; - }; - /** - * Path to the schema validation rule. - */ - schemaPath?: string; - }>; + 422: unknown; }; -export type PostV1BeaconImpressionByAdIdError = PostV1BeaconImpressionByAdIdErrors[keyof PostV1BeaconImpressionByAdIdErrors]; - export type PostV1BeaconImpressionByAdIdResponses = { /** - * Object with messages from the server. + * Accepted */ 202: { /** @@ -294,15 +266,19 @@ export type PostV1BeaconImpressionByAdIdResponses = { export type PostV1BeaconImpressionByAdIdResponse = PostV1BeaconImpressionByAdIdResponses[keyof PostV1BeaconImpressionByAdIdResponses]; export type PostV1BeaconClickByAdIdData = { - body?: { + body?: ({ + [key: string]: unknown; + } | { + [key: string]: unknown; + }) & { /** - * Unique identifier for the user within your platform. It must remain consistent across all user touchpoints and sales channels. + * Unique identifier for the user within your platform. It must remain consistent across all user touchpoints and sales channels. Required when `session_id` is not provided. */ user_id?: string; /** - * The user's session identifier. It has a limited lifespan and helps determine when a user transitions from anonymous to identified state. + * Persistent visitor identifier. Must remain stable for at least 14 days. For mobile apps, use the device ID (GAID on Android, IDFA on iOS). Required when `user_id` is not provided. */ - session_id: string; + session_id?: string; }; headers: { /** @@ -331,39 +307,14 @@ export type PostV1BeaconClickByAdIdData = { export type PostV1BeaconClickByAdIdErrors = { /** - * Field validation error list. + * Validation Error */ - 422: Array<{ - /** - * Path to the property with the error. - */ - instancePath?: string; - /** - * Validation keyword. - */ - keyword?: string; - /** - * Error message. - */ - message?: string; - /** - * Error parameters. - */ - params?: { - [key: string]: unknown; - }; - /** - * Path to the schema validation rule. - */ - schemaPath?: string; - }>; + 422: unknown; }; -export type PostV1BeaconClickByAdIdError = PostV1BeaconClickByAdIdErrors[keyof PostV1BeaconClickByAdIdErrors]; - export type PostV1BeaconClickByAdIdResponses = { /** - * Object with messages from the server. + * Accepted */ 202: { /** @@ -376,15 +327,19 @@ export type PostV1BeaconClickByAdIdResponses = { export type PostV1BeaconClickByAdIdResponse = PostV1BeaconClickByAdIdResponses[keyof PostV1BeaconClickByAdIdResponses]; export type PostV1BeaconViewByAdIdData = { - body?: { + body?: ({ + [key: string]: unknown; + } | { + [key: string]: unknown; + }) & { /** - * Unique identifier for the user within your platform. It must remain consistent across all user touchpoints and sales channels. + * Unique identifier for the user within your platform. It must remain consistent across all user touchpoints and sales channels. Required when `session_id` is not provided. */ user_id?: string; /** - * The user's session identifier. It has a limited lifespan and helps determine when a user transitions from anonymous to identified state. + * Persistent visitor identifier. Must remain stable for at least 14 days. For mobile apps, use the device ID (GAID on Android, IDFA on iOS). Required when `user_id` is not provided. */ - session_id: string; + session_id?: string; }; headers: { /** @@ -413,39 +368,14 @@ export type PostV1BeaconViewByAdIdData = { export type PostV1BeaconViewByAdIdErrors = { /** - * Field validation error list. + * Validation Error */ - 422: Array<{ - /** - * Path to the property with the error. - */ - instancePath?: string; - /** - * Validation keyword. - */ - keyword?: string; - /** - * Error message. - */ - message?: string; - /** - * Error parameters. - */ - params?: { - [key: string]: unknown; - }; - /** - * Path to the schema validation rule. - */ - schemaPath?: string; - }>; + 422: unknown; }; -export type PostV1BeaconViewByAdIdError = PostV1BeaconViewByAdIdErrors[keyof PostV1BeaconViewByAdIdErrors]; - export type PostV1BeaconViewByAdIdResponses = { /** - * Object with messages from the server. + * Accepted */ 202: { /** @@ -460,9 +390,13 @@ export type PostV1BeaconViewByAdIdResponse = PostV1BeaconViewByAdIdResponses[key export type PostV1BeaconConversionData = { body?: { /** - * Identifies the conversion channel. + * Identifies the conversion channel (for example, `ecommerce`, `app`, or `physical_store`). + */ + channel: string; + /** + * Brand or site where the sale occurred. Required when the publisher operates more than one site. */ - channel?: string; + brand?: string; /** * Publisher identification. */ @@ -513,7 +447,7 @@ export type PostV1BeaconConversionData = { product_id?: string; }>; /** - * Order creation date in ISO 8601 format (UTC - no timezone). + * Order creation date in ISO 8601 format in UTC (for example, `2026-01-01T09:20:00Z`). */ created_at: string; /** @@ -566,39 +500,14 @@ export type PostV1BeaconConversionData = { export type PostV1BeaconConversionErrors = { /** - * Field validation error list. + * Validation Error */ - 422: Array<{ - /** - * Path to the property with the error. - */ - instancePath?: string; - /** - * Validation keyword. - */ - keyword?: string; - /** - * Error message. - */ - message?: string; - /** - * Error parameters. - */ - params?: { - [key: string]: unknown; - }; - /** - * Path to the schema validation rule. - */ - schemaPath?: string; - }>; + 422: unknown; }; -export type PostV1BeaconConversionError = PostV1BeaconConversionErrors[keyof PostV1BeaconConversionErrors]; - export type PostV1BeaconConversionResponses = { /** - * Object with messages from the server. + * Accepted */ 202: { /** @@ -662,9 +571,9 @@ export type PostV1RmaByPublisherIdData = { */ types: Array<'product' | 'banner' | 'sponsored_brand' | 'digital_signage'>; /** - * Accepted media types. Only valid for banner and sponsored_brand types. + * Accepted media types. Only valid for `banner` and `sponsored_brand` types. Default: `["image"]`. */ - asset_types?: Array<'image' | 'video'>; + assets_type?: Array<'image' | 'video'>; /** * Allows the same SKU ads to appear multiple times in the same placement. Default=false. */ @@ -760,59 +669,32 @@ export type PostV1RmaByPublisherIdErrors = { * * Invalid request. */ - 400: { - [key: string]: unknown; - }; + 400: unknown; /** * Not Found * * Resource not found. */ - 404: { - [key: string]: unknown; - }; + 404: unknown; /** - * Field validation error list. + * Unprocessable Entity + * + * Field validation error. */ - 422: Array<{ - /** - * Path to the property with the error. - */ - instancePath?: string; - /** - * Validation keyword. - */ - keyword?: string; - /** - * Error message. - */ - message?: string; - /** - * Error parameters. - */ - params?: { - [key: string]: unknown; - }; - /** - * Path to the schema validation rule. - */ - schemaPath?: string; - }>; + 422: unknown; /** * Too Many Requests * * Rate limit exceeded. */ - 429: { - [key: string]: unknown; - }; + 429: unknown; }; -export type PostV1RmaByPublisherIdError = PostV1RmaByPublisherIdErrors[keyof PostV1RmaByPublisherIdErrors]; - export type PostV1RmaByPublisherIdResponses = { /** - * Object with ads for each placement. + * OK + * + * Query processed successfully. */ 200: { [key: string]: Array<{ @@ -824,10 +706,6 @@ export type PostV1RmaByPublisherIdResponses = { * URL of the image or video to be displayed. Present for banner, sponsored_brand, and digital_signage ad types. */ media_url?: string; - /** - * Destination URL of the ad (not all ads have a destination). - */ - destination_url?: string | null; /** * Type of ad. */ @@ -852,10 +730,6 @@ export type PostV1RmaByPublisherIdResponses = { * Product identifier. Present when ad type is 'product'. */ product_sku?: string; - /** - * Product name. Present when ad type is 'product'. - */ - product_name?: string; /** * Array of products associated with the sponsored brand. Present when ad type is 'sponsored_brand'. */ @@ -878,3 +752,2654 @@ export type PostV1RmaByPublisherIdResponses = { }; export type PostV1RmaByPublisherIdResponse = PostV1RmaByPublisherIdResponses[keyof PostV1RmaByPublisherIdResponses]; + +export type GetReportV2AdvertisersData = { + body?: never; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation Accept Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path?: never; + query: { + /** + * Start date for metrics in `YYYY-MM-DD` format. + */ + start_date: string; + /** + * End date for metrics in `YYYY-MM-DD` format. + */ + end_date: string; + /** + * If `true`, includes detailed account information in the result. + */ + account_info?: boolean; + /** + * Page number of the results. + */ + page?: number; + /** + * Number of items per page. When `download=true`, the BFF requests up to `20000` rows for XLSX generation. + */ + quantity?: number; + /** + * If `true`, returns the total number of available records. + */ + count?: boolean; + /** + * If `true`, returns an XLSX file buffer for download instead of JSON. + */ + download?: boolean; + }; + url: '/report/v2/advertisers'; +}; + +export type GetReportV2AdvertisersErrors = { + /** + * Unauthorized + * + * Missing or invalid authentication credentials. + */ + 401: unknown; +}; + +export type GetReportV2AdvertisersResponses = { + /** + * OK + * + * Report returned successfully. + */ + 200: { + /** + * Total number of advertisers available. + */ + total?: number; + /** + * Total number of pages for pagination. + */ + pages?: number; + /** + * Current page number. + */ + currentPage?: number; + /** + * Array of advertiser objects. + */ + data?: Array<{ + /** + * Unique advertiser identifier. + */ + id?: string; + /** + * Advertiser name. + */ + name?: string; + /** + * Account identifier. + */ + account_id?: string; + /** + * Checking account identifier. + */ + checking_account_id?: string; + /** + * Seller identifier (when applicable). + */ + seller_id?: string | null; + /** + * Tags associated with the advertiser. + */ + advertiser_tags?: Array | null; + /** + * Performance metrics object. All metric values are returned as strings regardless of their numeric nature. + */ + metrics?: { + /** + * Total number of campaigns. + */ + total_campaigns?: string; + /** + * Total daily budget amount. + */ + total_daily_budget?: string; + /** + * Account balance. + */ + balance?: string; + /** + * Advertiser identifier. + */ + advertiser_id?: string; + /** + * Total number of ad impressions. + */ + impressions?: string; + /** + * Total number of ad views. + */ + views?: string; + /** + * Total number of ad clicks. + */ + clicks?: string; + /** + * Total number of conversions. + */ + conversions?: string; + /** + * Conversion rate percentage. + */ + conversion_rate?: string; + /** + * Total quantity of items across all ad-driven conversions. Sums the quantities of every item in each conversion event (for example, if a shopper buys two units of a product after clicking an ad, this metric increases by 2). + */ + total_conversions_items_quantity?: string; + /** + * Click-through rate percentage. + */ + ctr?: string; + /** + * Total income generated. + */ + income?: string; + /** + * Effective cost per mille (CPM). + */ + ecpm?: string; + /** + * Total amount spent. + */ + total_spent?: string; + /** + * Cost per acquisition. + */ + cpa?: string; + /** + * Average cost per click. + */ + avg_cpc?: string; + /** + * Average cost per mille. + */ + avg_cpm?: string; + /** + * Total number of ad-driven conversions (sales attributed to an ad). Counts each conversion event as 1, regardless of how many items were purchased (for example, if a shopper buys two units of a product after clicking an ad, this metric increases by 1). + */ + conversions_quantity?: string; + /** + * Return on ad spend. + */ + roas?: string; + /** + * Ad cost. + */ + adcost?: string; + /** + * Amount of daily budget consumed. + */ + consumed_daily_budget?: string; + }; + /** + * URL of the advertiser's logo. + */ + account_logo?: string; + /** + * Theme configuration object. + */ + account_theme?: { + /** + * Primary color code (hex format). + */ + primary_color?: string; + /** + * Header color code (hex format). + */ + header_color?: string; + /** + * Secondary color code (hex format). + */ + second_color?: string; + /** + * Dark color code (hex format). + */ + dark_color?: string; + }; + }>; + }; +}; + +export type GetReportV2AdvertisersResponse = GetReportV2AdvertisersResponses[keyof GetReportV2AdvertisersResponses]; + +export type GetReportV2PublishersData = { + body?: never; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation Accept Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path?: never; + query: { + /** + * Start date for metrics in `YYYY-MM-DD` format. + */ + start_date: string; + /** + * End date for metrics in `YYYY-MM-DD` format. + */ + end_date: string; + /** + * Filters results by publisher name. + */ + publisher_name?: string; + /** + * If `true`, includes detailed account information in the result. + */ + account_info?: boolean; + /** + * Page number of the results. + */ + page?: number; + /** + * Number of items per page. When `download=true`, the BFF requests up to `20000` rows for XLSX generation. + */ + quantity?: number; + /** + * If `true`, returns the total number of available records. + */ + count?: boolean; + /** + * Field used to sort results. + */ + order_by?: 'name' | 'balance' | 'total_daily_budget' | 'total_campaigns' | 'impressions' | 'clicks' | 'ctr' | 'total_spent' | 'conversions' | 'conversion_rate' | 'income' | 'roas'; + /** + * Sort direction. + */ + order_direction?: 'asc' | 'desc'; + /** + * If `true`, returns an XLSX file buffer for download instead of JSON. + */ + download?: boolean; + }; + url: '/report/v2/publishers'; +}; + +export type GetReportV2PublishersErrors = { + /** + * Unauthorized + * + * Missing or invalid authentication credentials. + */ + 401: unknown; +}; + +export type GetReportV2PublishersResponses = { + /** + * OK + * + * Report returned successfully. + */ + 200: { + /** + * Total number of publishers available. + */ + total?: number; + /** + * Total number of pages for pagination. + */ + pages?: number; + /** + * Current page number. + */ + currentPage?: number; + /** + * Array of publisher objects. + */ + data?: Array<{ + /** + * Unique publisher identifier. + */ + id?: string; + /** + * Publisher name. + */ + name?: string; + /** + * Account identifier. + */ + account_id?: string; + /** + * Checking account identifier. + */ + checking_account_id?: string; + /** + * Performance metrics object. All metric values are returned as strings regardless of their numeric nature. + */ + metrics?: { + /** + * Total number of campaigns. + */ + total_campaigns?: string; + /** + * Total daily budget amount. + */ + total_daily_budget?: string; + /** + * Account balance. + */ + balance?: string; + /** + * Publisher identifier. + */ + publisher_id?: string; + /** + * Total number of ad impressions. + */ + impressions?: string; + /** + * Total number of ad views. + */ + views?: string; + /** + * Total number of ad clicks. + */ + clicks?: string; + /** + * Total number of conversions. + */ + conversions?: string; + /** + * Conversion rate percentage. + */ + conversion_rate?: string; + /** + * Total quantity of items across all ad-driven conversions. Sums the quantities of every item in each conversion event (for example, if a shopper buys two units of a product after clicking an ad, this metric increases by 2). + */ + total_conversions_items_quantity?: string; + /** + * Click-through rate percentage. + */ + ctr?: string; + /** + * Total income generated. + */ + income?: string; + /** + * Effective cost per mille (CPM). + */ + ecpm?: string; + /** + * Total amount spent. + */ + total_spent?: string; + /** + * Cost per acquisition. + */ + cpa?: string; + /** + * Average cost per click. + */ + avg_cpc?: string; + /** + * Average cost per mille. + */ + avg_cpm?: string; + /** + * Total number of ad-driven conversions (sales attributed to an ad). Counts each conversion event as 1, regardless of how many items were purchased (for example, if a shopper buys two units of a product after clicking an ad, this metric increases by 1). + */ + conversions_quantity?: string; + /** + * Return on ad spend. + */ + roas?: string; + /** + * Ad cost. + */ + adcost?: string; + }; + /** + * URL of the publisher's logo. + */ + account_logo?: string; + /** + * Theme configuration object. + */ + account_theme?: { + /** + * Primary color code (hex format). + */ + primary_color?: string; + /** + * Header color code (hex format). + */ + header_color?: string; + /** + * Secondary color code (hex format). + */ + second_color?: string; + /** + * Dark color code (hex format). + */ + dark_color?: string; + }; + }>; + }; +}; + +export type GetReportV2PublishersResponse = GetReportV2PublishersResponses[keyof GetReportV2PublishersResponses]; + +export type GetReportNetworkPublishersData = { + body?: never; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation Accept Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path?: never; + query: { + /** + * Start date for metrics in `YYYY-MM-DD` format. + */ + start_date: string; + /** + * End date for metrics in `YYYY-MM-DD` format. + */ + end_date: string; + /** + * Filters results by publisher name. + */ + publisher_name?: string; + /** + * If `true`, includes detailed account information in the result. + */ + account_info?: boolean; + /** + * Page number of the results. + */ + page?: number; + /** + * Number of items per page. When `download=true`, the BFF requests up to `20000` rows for XLSX generation. + */ + quantity?: number; + /** + * If `true`, returns the total number of available records. + */ + count?: boolean; + /** + * Field used to sort results. + */ + order_by?: 'name' | 'impressions' | 'clicks' | 'ctr' | 'conversions' | 'conversion_rate' | 'income' | 'roas' | 'requests'; + /** + * Sort direction. + */ + order_direction?: 'asc' | 'desc'; + /** + * If `true`, returns an XLSX file buffer for download instead of JSON. + */ + download?: boolean; + }; + url: '/report/network/publishers'; +}; + +export type GetReportNetworkPublishersErrors = { + /** + * Unauthorized + * + * Missing or invalid authentication credentials. + */ + 401: unknown; +}; + +export type GetReportNetworkPublishersResponses = { + /** + * OK + * + * Report returned successfully. + */ + 200: { + /** + * Total number of network publishers available. + */ + total?: number; + /** + * Total number of pages for pagination. + */ + pages?: number; + /** + * Current page number. + */ + currentPage?: number; + /** + * Array of network publisher objects. + */ + data?: Array<{ + /** + * Unique network publisher identifier. + */ + id?: string; + /** + * Publisher name. + */ + name?: string; + /** + * Account identifier. + */ + account_id?: string; + /** + * Performance metrics object. All metric values are returned as strings regardless of their numeric nature. + */ + metrics?: { + /** + * Publisher identifier. + */ + publisher_id?: string; + /** + * Total number of ad impressions. + */ + impressions?: string; + /** + * Total number of ad views. + */ + views?: string; + /** + * Total number of ad clicks. + */ + clicks?: string; + /** + * Total number of conversions. + */ + conversions?: string; + /** + * Conversion rate percentage. + */ + conversion_rate?: string; + /** + * Total quantity of items across all ad-driven conversions. Sums the quantities of every item in each conversion event (for example, if a shopper buys two units of a product after clicking an ad, this metric increases by 2). + */ + total_conversions_items_quantity?: string; + /** + * Click-through rate percentage. + */ + ctr?: string; + /** + * Total income generated. + */ + income?: string; + /** + * Effective cost per mille (CPM). + */ + ecpm?: string; + /** + * Total amount spent. + */ + total_spent?: string; + /** + * Cost per acquisition. + */ + cpa?: string; + /** + * Average cost per click. + */ + avg_cpc?: string; + /** + * Average cost per mille. + */ + avg_cpm?: string; + /** + * Total number of ad-driven conversions (sales attributed to an ad). Counts each conversion event as 1, regardless of how many items were purchased (for example, if a shopper buys two units of a product after clicking an ad, this metric increases by 1). + */ + conversions_quantity?: string; + /** + * Return on ad spend. + */ + roas?: string; + /** + * Ad cost. + */ + adcost?: string; + /** + * Total number of ad requests. + */ + requests?: string; + }; + /** + * URL of the publisher's logo. + */ + account_logo?: string; + /** + * Theme configuration object. + */ + account_theme?: { + /** + * Primary color code (hex format). + */ + primary_color?: string; + /** + * Header color code (hex format). + */ + header_color?: string; + /** + * Secondary color code (hex format). + */ + second_color?: string; + /** + * Dark color code (hex format). + */ + dark_color?: string; + }; + }>; + }; +}; + +export type GetReportNetworkPublishersResponse = GetReportNetworkPublishersResponses[keyof GetReportNetworkPublishersResponses]; + +export type GetCampaignV2Data = { + body?: never; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation Accept Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path?: never; + query: { + /** + * Start date for metrics in `YYYY-MM-DD` format. + */ + start_date: string; + /** + * End date for metrics in `YYYY-MM-DD` format. + */ + end_date: string; + /** + * Filters by campaign status. + */ + status?: string; + /** + * Filters campaigns by advertiser ID. + */ + advertiser_id?: string; + /** + * Filters by ad type. + */ + ad_type?: 'banner' | 'product' | 'sponsored_brand' | 'digital_signage'; + /** + * Searches campaigns by name. + */ + name?: string; + /** + * If `true`, includes detailed account information in the result. + */ + account_info?: boolean; + /** + * Page number of the results. + */ + page?: number; + /** + * Number of items per page. When `download=true`, the BFF requests up to `20000` rows for XLSX generation. + */ + quantity?: number; + /** + * If `true`, returns the total number of available records. + */ + count?: boolean; + /** + * Field used to sort results. + */ + order_by?: 'name' | 'impressions' | 'clicks' | 'ctr' | 'conversions' | 'conversion_rate' | 'income' | 'roas' | 'created_at' | 'start_at' | 'daily_budget' | 'ad_type' | 'advertiser_name' | 'status'; + /** + * Sort direction. + */ + order_direction?: 'asc' | 'desc'; + /** + * If `true`, returns an XLSX file buffer for download instead of JSON. + */ + download?: boolean; + }; + url: '/campaign/v2'; +}; + +export type GetCampaignV2Errors = { + /** + * Unauthorized + * + * Missing or invalid authentication credentials. + */ + 401: unknown; +}; + +export type GetCampaignV2Responses = { + /** + * OK + * + * Campaigns returned successfully. + */ + 200: { + /** + * Total number of campaigns. + */ + total?: number; + /** + * Total number of pages for pagination. + */ + pages?: number; + /** + * Current page number. + */ + currentPage?: number; + /** + * Array of campaign objects. + */ + data?: Array<{ + /** + * Unique campaign identifier. + */ + id?: string; + /** + * Advertiser identifier. + */ + advertiser_id?: string; + /** + * Campaign name. + */ + name?: string; + /** + * Campaign status. + */ + status?: string; + /** + * Campaign type. + */ + type?: string; + /** + * Campaign settings object. The fields are dynamic and may vary depending on the campaign type. + */ + settings?: { + /** + * Daily budget amount. + */ + daily_budget?: number; + /** + * Cost per click value. + */ + cpc?: number; + /** + * Cost per mille value. + */ + cpm?: number; + /** + * Budget distribution type. + */ + budget_type?: string; + }; + /** + * Campaign start date in ISO 8601 format. + */ + start_at?: string; + /** + * Campaign end date in ISO 8601 format. + */ + end_at?: string; + /** + * Campaign disabled date in ISO 8601 format. + */ + disabled_at?: string | null; + /** + * Campaign creation date in ISO 8601 format. + */ + created_at?: string; + /** + * Campaign last update date in ISO 8601 format. + */ + updated_at?: string; + /** + * Campaign deletion date in ISO 8601 format. + */ + deleted_at?: string | null; + /** + * Campaign description. + */ + description?: string | null; + /** + * Publisher identifier. + */ + publisher_id?: string; + /** + * Advertisement type. + */ + ad_type?: string; + /** + * Campaign internal ID. + */ + cid?: number; + /** + * Seller identifier (when applicable). + */ + seller_id?: string | null; + /** + * Campaign target (when applicable). + */ + target?: string; + /** + * Network identifier (when applicable). + */ + network_id?: string | null; + /** + * Audience identifier (when applicable). + */ + audience_id?: string | null; + /** + * Targeting type. + */ + targeting_type?: string | null; + /** + * Campaign strategy type. + */ + strategy_type?: string; + /** + * Total campaign budget. + */ + total_budget?: string; + /** + * Whether the campaign is active. + */ + active?: boolean; + /** + * Advertiser name. + */ + advertiser_name?: string; + /** + * Advertiser account identifier. + */ + advertiser_account_id?: string; + /** + * Publisher name. + */ + publisher_name?: string; + /** + * Publisher account identifier. + */ + publisher_account_id?: string; + /** + * Amount of budget consumed. + */ + consumed_budget?: string; + /** + * Daily budget amount. + */ + daily_budget?: string; + /** + * Campaign status code. + */ + campaign_status?: number; + /** + * Tags associated with the advertiser. + */ + advertiser_tags?: Array | null; + /** + * Pending operations awaiting review for this campaign/ad. Empty when there is nothing pending. + */ + pending?: Array<{ + /** + * Type of pending operation. Currently, only `ads` is returned, indicating ads awaiting review. + */ + label?: 'ads'; + /** + * Number of pending items of the given `label`. + */ + quantity?: number; + }>; + /** + * Performance metrics object. All metric values are returned as strings regardless of their numeric nature. + */ + metrics?: { + /** + * Total number of clicks. + */ + clicks?: number; + /** + * Total number of conversions. + */ + conversions?: number; + /** + * Total number of impressions. + */ + impressions?: number; + /** + * Total number of views. + */ + views?: number; + /** + * Number of conversions attributed to clicks. + */ + conversions_click?: string; + /** + * Number of conversions attributed to views. + */ + conversions_view?: string; + /** + * Consolidated conversion rate percentage, calculated as total conversions divided by the sum of clicks and views (`total_conversions / (total_clicks + total_views)`). This is the default conversion rate and considers both click- and view-attributed conversions. + */ + conversion_rate?: string; + /** + * Conversion rate percentage considering click-attributed conversions only, calculated as `conversions_click / total_clicks`. + */ + conversion_rate_click?: string; + /** + * Conversion rate percentage considering view-attributed conversions only, calculated as `conversions_view / total_views`. + */ + conversion_rate_view?: string; + /** + * Click-through rate percentage. + */ + ctr?: string; + /** + * Consolidated return on ad spend, combining click- and view-attributed revenue across all ad formats. + */ + roas?: string; + /** + * Return on ad spend calculated using click-attributed revenue only. + */ + roas_click?: string; + /** + * Return on ad spend calculated using view-attributed revenue only. + */ + roas_view?: string; + /** + * Halo return on ad spend: incremental revenue from non-advertised products purchased in the same order as advertised products (the halo effect), divided by ad spend. + */ + roas_halo?: string; + /** + * Total return on ad spend, combining direct revenue from the advertised product with halo revenue from other products in the same order, divided by the ad investment. Measures the campaign's total impact on the whole order. + */ + roas_overall?: string; + /** + * Ad cost percentage. + */ + adcost?: string; + /** + * Total income generated. + */ + income?: string; + /** + * Total amount spent. + */ + total_spent?: string; + /** + * Effective cost per mille (CPM). + */ + ecpm?: string; + /** + * Cost per acquisition. + */ + cpa?: string; + /** + * Average cost per click. + */ + avg_cpc?: string; + /** + * Average cost per mille. + */ + avg_cpm?: string; + /** + * Incremental revenue from non-advertised products that were purchased in the same order as an advertised product, attributed to the ad's spillover (halo) effect. + */ + halo_revenue?: string; + /** + * Number of orders with at least one halo item. + */ + halo_orders?: string; + /** + * Quantity of halo items sold. + */ + halo_items?: string; + }; + }>; + }; +}; + +export type GetCampaignV2Response = GetCampaignV2Responses[keyof GetCampaignV2Responses]; + +export type GetCampaignByCampaignIdData = { + body?: never; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation Accept Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path: { + /** + * Unique identifier of the campaign to fetch. + */ + campaign_id: string; + }; + query: { + /** + * Start date for metrics in `YYYY-MM-DD` format. + */ + start_date: string; + /** + * End date for metrics in `YYYY-MM-DD` format. + */ + end_date: string; + }; + url: '/campaign/{campaign_id}'; +}; + +export type GetCampaignByCampaignIdErrors = { + /** + * Unauthorized + * + * Missing or invalid authentication credentials. + */ + 401: unknown; + /** + * Not Found + * + * Campaign not found. + */ + 404: unknown; +}; + +export type GetCampaignByCampaignIdResponses = { + /** + * OK + * + * Campaign returned successfully. + */ + 200: { + /** + * Unique campaign identifier. + */ + id?: string; + /** + * Advertiser identifier. + */ + advertiser_id?: string; + /** + * Campaign name. + */ + name?: string; + /** + * Campaign description. + */ + description?: string | null; + /** + * Campaign status. + */ + status?: string; + /** + * Campaign type. + */ + type?: string; + /** + * Campaign settings object. The fields are dynamic and may vary depending on the campaign type. + */ + settings?: { + /** + * Daily budget amount. + */ + daily_budget?: number; + /** + * Cost per click value. + */ + cpc?: number; + /** + * Cost per mille value. + */ + cpm?: number; + /** + * Budget distribution type. + */ + budget_type?: string; + }; + /** + * Campaign start date in ISO 8601 format. + */ + start_at?: string; + /** + * Campaign end date in ISO 8601 format. + */ + end_at?: string; + /** + * Campaign creation date in ISO 8601 format. + */ + created_at?: string; + /** + * Campaign last update date in ISO 8601 format. + */ + updated_at?: string; + /** + * Campaign deletion date in ISO 8601 format. + */ + deleted_at?: string | null; + /** + * Advertisement type. + */ + ad_type?: string; + /** + * Targeting type. + */ + targeting_type?: string; + /** + * Campaign strategy type. + */ + strategy_type?: string; + /** + * Total campaign budget. + */ + total_budget?: string; + /** + * Whether the campaign is active. + */ + active?: boolean; + /** + * Publisher identifier. + */ + publisher_id?: string; + /** + * Seller identifier (when applicable). + */ + seller_id?: string | null; + /** + * Campaign target (when applicable). + */ + target?: string; + /** + * Network identifier (when applicable). + */ + network_id?: string | null; + /** + * Audience identifier (when applicable). + */ + audience_id?: string | null; + /** + * Advertiser name. + */ + advertiser_name?: string; + /** + * Advertiser account identifier. + */ + advertiser_account_id?: string; + /** + * Publisher name. + */ + publisher_name?: string; + /** + * Publisher account identifier. + */ + publisher_account_id?: string; + /** + * Total quantity of conversions. + */ + conversions_quantity?: string; + /** + * Amount of budget consumed. + */ + consumed_budget?: string; + /** + * Pending operations awaiting review for this campaign/ad. Empty when there is nothing pending. + */ + pending?: Array<{ + /** + * Type of pending operation. Currently, only `ads` is returned, indicating ads awaiting review. + */ + label?: 'ads'; + /** + * Number of pending items of the given `label`. + */ + quantity?: number; + }>; + /** + * Performance metrics object. All metric values are returned as strings regardless of their numeric nature. + */ + metrics?: { + /** + * Total number of clicks. + */ + clicks?: number; + /** + * Total number of conversions. + */ + conversions?: number; + /** + * Total number of impressions. + */ + impressions?: number; + /** + * Total number of views. + */ + views?: number; + /** + * Number of conversions attributed to clicks. + */ + conversions_click?: string; + /** + * Number of conversions attributed to views. + */ + conversions_view?: string; + /** + * Consolidated conversion rate percentage, calculated as total conversions divided by the sum of clicks and views (`total_conversions / (total_clicks + total_views)`). This is the default conversion rate and considers both click- and view-attributed conversions. + */ + conversion_rate?: string; + /** + * Conversion rate percentage considering click-attributed conversions only, calculated as `conversions_click / total_clicks`. + */ + conversion_rate_click?: string; + /** + * Conversion rate percentage considering view-attributed conversions only, calculated as `conversions_view / total_views`. + */ + conversion_rate_view?: string; + /** + * Click-through rate percentage. + */ + ctr?: string; + /** + * Consolidated return on ad spend, combining click- and view-attributed revenue across all ad formats. + */ + roas?: string; + /** + * Return on ad spend calculated using click-attributed revenue only. + */ + roas_click?: string; + /** + * Return on ad spend calculated using view-attributed revenue only. + */ + roas_view?: string; + /** + * Halo return on ad spend: incremental revenue from non-advertised products purchased in the same order as advertised products (the halo effect), divided by ad spend. + */ + roas_halo?: string; + /** + * Total return on ad spend, combining direct revenue from the advertised product with halo revenue from other products in the same order, divided by the ad investment. Measures the campaign's total impact on the whole order. + */ + roas_overall?: string; + /** + * Ad cost percentage. + */ + adcost?: string; + /** + * Total income generated. + */ + income?: string; + /** + * Total amount spent. + */ + total_spent?: string; + /** + * Effective cost per mille (CPM). + */ + ecpm?: string; + /** + * Cost per acquisition. + */ + cpa?: string; + /** + * Average cost per click. + */ + avg_cpc?: string; + /** + * Average cost per mille. + */ + avg_cpm?: string; + /** + * Incremental revenue from non-advertised products that were purchased in the same order as an advertised product, attributed to the ad's spillover (halo) effect. + */ + halo_revenue?: string; + /** + * Number of orders with at least one halo item. + */ + halo_orders?: string; + /** + * Quantity of halo items sold. + */ + halo_items?: string; + }; + /** + * Array of ad objects associated with the campaign. + */ + ads?: Array<{ + /** + * Unique ad identifier. + */ + id?: string; + /** + * Associated campaign identifier. + */ + campaign_id?: string; + /** + * Ad destination URL. + */ + url?: string; + /** + * Ad-specific settings object. The fields are dynamic and may vary depending on the ad type. + */ + settings?: { + /** + * Ad dimensions/size specification. + */ + ad_size?: string; + /** + * URL of the ad media asset. + */ + media_url?: string; + /** + * Ad type. + */ + type?: string; + }; + /** + * Ad disabled date in ISO 8601 format. + */ + disabled_at?: string | null; + /** + * Ad creation date in ISO 8601 format. + */ + created_at?: string; + /** + * Ad last update date in ISO 8601 format. + */ + updated_at?: string; + /** + * Ad deletion date in ISO 8601 format. + */ + deleted_at?: string | null; + /** + * Ad status. + */ + status?: string; + /** + * Ad internal ID. + */ + aid?: number; + /** + * Asset type (for example, `image`, `video`). + */ + asset_type?: string; + /** + * Whether the ad is active. + */ + active?: boolean; + /** + * Associated campaign name. + */ + campaign_name?: string; + /** + * Advertisement type. + */ + ad_type?: string; + /** + * Associated campaign status. + */ + campaign_status?: string; + /** + * Whether the ad is currently running. + */ + is_running?: boolean; + /** + * Associated campaign settings. The fields are dynamic and may vary depending on the campaign type. + */ + campaign_settings?: { + /** + * Daily budget amount. + */ + daily_budget?: number; + /** + * Cost per mille value. + */ + cpm?: number; + /** + * Budget distribution type. + */ + budget_type?: string; + }; + /** + * Ad-specific performance metrics. All metric values are returned as strings regardless of their numeric nature. + */ + metrics?: { + [key: string]: unknown; + }; + }>; + /** + * Array of products associated with the campaign. + */ + products?: Array<{ + /** + * Unique product identifier. + */ + id?: string; + /** + * Product name. + */ + name?: string; + /** + * Product SKU. + */ + sku?: string; + /** + * Product image URL. + */ + image_url?: string; + }>; + /** + * Array of status change history. + */ + status_history?: Array<{ + /** + * Unique status change identifier. + */ + id?: string; + /** + * Status value. + */ + status?: string; + /** + * Status change date in ISO 8601 format. + */ + created_at?: string; + }>; + }; +}; + +export type GetCampaignByCampaignIdResponse = GetCampaignByCampaignIdResponses[keyof GetCampaignByCampaignIdResponses]; + +export type GetReportAdvertisersCampaignsDetailedData = { + body?: never; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation Accept Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path?: never; + query: { + /** + * Start date for metrics in `YYYY-MM-DD` format. + */ + start_date: string; + /** + * End date for metrics in `YYYY-MM-DD` format. + */ + end_date: string; + /** + * Filters by campaign ID. + */ + campaign_id?: string; + /** + * Filters by campaign status. + */ + campaign_status?: string; + /** + * Filters by publisher ID. + */ + publisher_id?: string; + /** + * Filters by publisher name. + */ + publisher_name?: string; + /** + * Filters by ad type. + */ + ad_type?: 'banner' | 'product' | 'sponsored_brand' | 'digital_signage'; + /** + * Filters by ad status. + */ + ad_status?: 'enabled' | 'paused' | 'rejected' | 'pending_review' | 'stock_out' | 'invalid_cost'; + /** + * Filters by seller ID. + */ + seller_id?: string; + /** + * Filters by advertiser tag ID. + */ + tag_id?: string; + /** + * Filters by targeting type. + */ + targeting_type?: string; + /** + * Filters network rows by subpublisher ID. + */ + sub_publisher_id?: string; + /** + * Filters network rows by subpublisher name. + */ + sub_publisher_name?: string; + /** + * Page number of the results. + */ + page?: number; + /** + * Number of items per page. When `download=true`, the BFF requests up to `20000` rows for XLSX generation. + */ + quantity?: number; + /** + * If `true`, returns pagination metadata. + */ + count?: boolean; + /** + * Field used to sort results. + */ + order_by?: 'advertiser_name' | 'name' | 'ad_type' | 'status' | 'sub_publisher_name' | 'daily_budget' | 'impressions' | 'views' | 'clicks' | 'ctr' | 'total_spent' | 'conversions' | 'conversion_rate' | 'income' | 'roas' | 'created_at' | 'start_at'; + /** + * Sort direction. + */ + order_direction?: 'asc' | 'desc'; + /** + * If `true`, returns an XLSX file buffer for download instead of JSON. + */ + download?: boolean; + }; + url: '/report/advertisers/campaigns-detailed'; +}; + +export type GetReportAdvertisersCampaignsDetailedErrors = { + /** + * Unauthorized + * + * Missing or invalid authentication credentials. + */ + 401: unknown; +}; + +export type GetReportAdvertisersCampaignsDetailedResponses = { + /** + * OK + * + * Report returned successfully. + */ + 200: { + /** + * Total number of campaigns. + */ + total?: number; + /** + * Total number of pages for pagination. + */ + pages?: number; + /** + * Current page number. + */ + currentPage?: number; + /** + * Array of detailed campaign objects. + */ + data?: Array<{ + /** + * Unique campaign identifier. + */ + id?: string; + /** + * Advertiser identifier. + */ + advertiser_id?: string; + /** + * Campaign name. + */ + name?: string; + /** + * Campaign status. + */ + status?: string; + /** + * Campaign type. + */ + type?: string; + /** + * Publisher identifier. + */ + publisher_id?: string; + /** + * Publisher name. + */ + publisher_name?: string; + /** + * Advertiser name. + */ + advertiser_name?: string; + /** + * Subpublisher identifier (only present for network campaigns). + */ + sub_publisher_id?: string | null; + /** + * Subpublisher name (only present for network campaigns). + */ + sub_publisher_name?: string | null; + /** + * Whether the campaign is active. + */ + active?: boolean; + /** + * Daily budget amount. + */ + daily_budget?: string; + /** + * Amount of budget consumed. + */ + consumed_budget?: string; + /** + * Pending operations awaiting review for this campaign/ad. Empty when there is nothing pending. + */ + pending?: Array<{ + /** + * Type of pending operation. Currently, only `ads` is returned, indicating ads awaiting review. + */ + label?: 'ads'; + /** + * Number of pending items of the given `label`. + */ + quantity?: number; + }>; + /** + * Performance metrics object. All metric values are returned as strings regardless of their numeric nature. + */ + metrics?: { + /** + * Total number of clicks. + */ + clicks?: number; + /** + * Total number of conversions. + */ + conversions?: number; + /** + * Total quantity of converted items. + */ + total_conversions_items_quantity?: number; + /** + * Total number of impressions. + */ + impressions?: number; + /** + * Total number of views. + */ + views?: number; + /** + * Number of conversions attributed to clicks. + */ + conversions_click?: string; + /** + * Number of conversions attributed to views. + */ + conversions_view?: string; + /** + * Consolidated conversion rate percentage, calculated as total conversions divided by the sum of clicks and views (`total_conversions / (total_clicks + total_views)`). This is the default conversion rate and considers both click- and view-attributed conversions. + */ + conversion_rate?: string; + /** + * Conversion rate percentage considering click-attributed conversions only, calculated as `conversions_click / total_clicks`. + */ + conversion_rate_click?: string; + /** + * Conversion rate percentage considering view-attributed conversions only, calculated as `conversions_view / total_views`. + */ + conversion_rate_view?: string; + /** + * Click-through rate percentage. + */ + ctr?: string; + /** + * Consolidated return on ad spend, combining click- and view-attributed revenue across all ad formats. + */ + roas?: string; + /** + * Return on ad spend calculated using click-attributed revenue only. + */ + roas_click?: string; + /** + * Return on ad spend calculated using view-attributed revenue only. + */ + roas_view?: string; + /** + * Halo return on ad spend: incremental revenue from non-advertised products purchased in the same order as advertised products (the halo effect), divided by ad spend. + */ + roas_halo?: string; + /** + * Total return on ad spend, combining direct revenue from the advertised product with halo revenue from other products in the same order, divided by the ad investment. Measures the campaign's total impact on the whole order. + */ + roas_overall?: string; + /** + * Ad cost percentage. + */ + adcost?: string; + /** + * Total income generated. + */ + income?: string; + /** + * Total amount spent. + */ + total_spent?: string; + /** + * Effective cost per mille (CPM). + */ + ecpm?: string; + /** + * Cost per acquisition. + */ + cpa?: string; + /** + * Average cost per click. + */ + avg_cpc?: string; + /** + * Average cost per mille. + */ + avg_cpm?: string; + /** + * Incremental revenue from non-advertised products that were purchased in the same order as an advertised product, attributed to the ad's spillover (halo) effect. + */ + halo_revenue?: string; + /** + * Number of orders with at least one halo item. + */ + halo_orders?: string; + /** + * Quantity of halo items sold. + */ + halo_items?: string; + }; + }>; + }; +}; + +export type GetReportAdvertisersCampaignsDetailedResponse = GetReportAdvertisersCampaignsDetailedResponses[keyof GetReportAdvertisersCampaignsDetailedResponses]; + +export type GetReportAdvertisersAdsDetailedData = { + body?: never; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation Accept Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path?: never; + query: { + /** + * Start date for metrics in `YYYY-MM-DD` format. + */ + start_date: string; + /** + * End date for metrics in `YYYY-MM-DD` format. + */ + end_date: string; + /** + * Filters ads by campaign name. + */ + campaign_name?: string; + /** + * Filters ads by campaign ID. + */ + campaign_id?: string; + /** + * Filters ads by publisher ID. + */ + publisher_id?: string; + /** + * Filters ads by advertiser ID. In the BFF flow, this value is derived from the authenticated advertiser context. + */ + advertiser_id?: string; + /** + * Filters ads by product SKU. + */ + product_sku?: string; + /** + * Filters ads by status. + */ + ad_status?: 'enabled' | 'paused' | 'rejected' | 'pending_review' | 'stock_out' | 'invalid_cost'; + /** + * Filters by ad type. + */ + ad_type?: 'banner' | 'product' | 'sponsored_brand' | 'digital_signage'; + /** + * Filters by targeting type. + */ + targeting_type?: string; + /** + * Filters by advertiser tag ID. + */ + tag_id?: string; + /** + * Filters network rows by subpublisher ID. + */ + sub_publisher_id?: string; + /** + * Filters network rows by subpublisher name. + */ + sub_publisher_name?: string; + /** + * If `true`, includes paused ads. + */ + show_inactive?: boolean; + /** + * If `true`, excludes `pending_review` and `rejected` rows when `ad_status` is not provided. + */ + hide_pending_rejected?: boolean; + /** + * Page number of the results. + */ + page?: number; + /** + * Number of items per page. When `download=true`, the BFF requests up to `20000` rows for XLSX generation. + */ + quantity?: number; + /** + * If `true`, returns pagination metadata. + */ + count?: boolean; + /** + * Field used to sort results. + */ + order_by?: 'ad_type' | 'ad_status' | 'impressions' | 'conversion_rate' | 'ctr' | 'income' | 'total_spent' | 'roas' | 'conversions' | 'total_conversions_items_quantity' | 'advertiser_name' | 'campaign_name' | 'clicks' | 'adcost' | 'created_at' | 'sub_publisher_name'; + /** + * Sort direction. + */ + order_direction?: 'asc' | 'desc'; + /** + * If `true`, returns an XLSX file buffer for download instead of JSON. + */ + download?: boolean; + }; + url: '/report/advertisers/ads-detailed'; +}; + +export type GetReportAdvertisersAdsDetailedErrors = { + /** + * Unauthorized + * + * Missing or invalid authentication credentials. + */ + 401: unknown; +}; + +export type GetReportAdvertisersAdsDetailedResponses = { + /** + * OK + * + * Report returned successfully. + */ + 200: { + /** + * Total number of ads. + */ + total?: number; + /** + * Total number of pages for pagination. + */ + pages?: number; + /** + * Current page number. + */ + currentPage?: number; + /** + * Array of detailed ad objects. + */ + data?: Array<{ + /** + * Unique ad identifier. + */ + id?: string; + /** + * Associated campaign identifier. + */ + campaign_id?: string; + /** + * Ad destination URL. + */ + url?: string; + /** + * Ad status. + */ + status?: string; + /** + * Whether the ad is active. + */ + active?: boolean; + /** + * Associated product SKU (when applicable). + */ + product_sku?: string | null; + /** + * Associated campaign name. + */ + campaign_name?: string; + /** + * Associated campaign status. + */ + campaign_status?: string; + /** + * Advertisement type. + */ + ad_type?: string; + /** + * Publisher identifier. + */ + publisher_id?: string; + /** + * Publisher name. + */ + publisher_name?: string; + /** + * Publisher account identifier. + */ + publisher_account_id?: string; + /** + * Advertiser identifier. + */ + advertiser_id?: string; + /** + * Advertiser name. + */ + advertiser_name?: string; + /** + * Advertiser account identifier. + */ + advertiser_account_id?: string; + /** + * Subpublisher identifier (only present for network campaigns). + */ + sub_publisher_id?: string | null; + /** + * Subpublisher name (only present for network campaigns). + */ + sub_publisher_name?: string | null; + /** + * Subpublisher account identifier (only present for network campaigns). + */ + sub_publisher_account_id?: string | null; + /** + * Ad performance metrics object. All metric values are returned as strings regardless of their numeric nature. + */ + metrics?: { + /** + * Total number of clicks. + */ + clicks?: string; + /** + * Total number of conversions. + */ + conversions?: string; + /** + * Total quantity of items across all ad-driven conversions. Sums the quantities of every item in each conversion event (for example, if a shopper buys two units of a product after clicking an ad, this metric increases by 2). + */ + total_conversions_items_quantity?: string; + /** + * Total number of impressions. + */ + impressions?: string; + /** + * Total number of views. + */ + views?: string; + /** + * Conversion rate percentage. + */ + conversion_rate?: string; + /** + * Click-through rate percentage. + */ + ctr?: string; + /** + * Return on ad spend. + */ + roas?: string; + /** + * Ad cost percentage. + */ + adcost?: string; + /** + * Total income generated. + */ + income?: string; + /** + * Total amount spent. + */ + total_spent?: string; + /** + * Effective cost per mille (CPM). + */ + ecpm?: string; + /** + * Cost per acquisition. + */ + cpa?: string; + /** + * Average cost per click. + */ + avg_cpc?: string; + /** + * Average cost per mille. + */ + avg_cpm?: string; + }; + }>; + }; +}; + +export type GetReportAdvertisersAdsDetailedResponse = GetReportAdvertisersAdsDetailedResponses[keyof GetReportAdvertisersAdsDetailedResponses]; + +export type GetAdResultsV2Data = { + body?: never; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation Accept Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path?: never; + query: { + /** + * Start date for metrics in `YYYY-MM-DD` format. + */ + start_date: string; + /** + * End date for metrics in `YYYY-MM-DD` format. + */ + end_date: string; + /** + * Filters ads by campaign name. + */ + campaign_name?: string; + /** + * Filters ads by campaign ID. + */ + campaign_id?: string; + /** + * Filters ads by advertiser ID. + */ + advertiser_id?: string; + /** + * Filters ads by product SKU. + */ + product_sku?: string; + /** + * Filters ads by status. + */ + ad_status?: 'enabled' | 'paused' | 'rejected' | 'pending_review' | 'stock_out' | 'invalid_cost'; + /** + * Filters by ad type. + */ + ad_type?: 'banner' | 'product' | 'sponsored_brand' | 'digital_signage'; + /** + * Filters by targeting type. + */ + targeting_type?: string; + /** + * If `true`, includes paused ads. + */ + show_inactive?: boolean; + /** + * If `true`, includes detailed account information in the result. + */ + account_info?: boolean; + /** + * Page number of the results. + */ + page?: number; + /** + * Number of items per page. When `download=true`, the BFF requests up to `20000` rows for XLSX generation. + */ + quantity?: number; + /** + * If `true`, returns the total number of available records. + */ + count?: boolean; + /** + * Field used to sort results. + */ + order_by?: 'ad_type' | 'ad_status' | 'impressions' | 'conversion_rate' | 'ctr' | 'income' | 'total_spent' | 'roas' | 'conversions' | 'total_conversions_item_quantity'; + /** + * Sort direction. + */ + order_direction?: 'asc' | 'desc'; + /** + * If `true`, returns an XLSX file buffer for download instead of JSON. + */ + download?: boolean; + }; + url: '/ad/results/v2'; +}; + +export type GetAdResultsV2Errors = { + /** + * Unauthorized + * + * Missing or invalid authentication credentials. + */ + 401: unknown; +}; + +export type GetAdResultsV2Responses = { + /** + * OK + * + * Report returned successfully. + */ + 200: { + /** + * Total number of ads. + */ + total?: number; + /** + * Total number of pages for pagination. + */ + pages?: number; + /** + * Current page number. + */ + currentPage?: number; + /** + * Array of ad objects. + */ + data?: Array<{ + /** + * Unique ad identifier. + */ + id?: string; + /** + * Associated campaign identifier. + */ + campaign_id?: string; + /** + * Ad destination URL. + */ + url?: string; + /** + * Ad-specific settings object. The fields are dynamic and may vary depending on the ad type. + */ + settings?: { + /** + * Cost per click value. + */ + cpc?: number; + /** + * Cost per mille value. + */ + cpm?: number; + /** + * Ad type. + */ + type?: string; + /** + * Targeted categories array. + */ + categories?: Array; + /** + * Targeted keywords array. + */ + keywords?: Array; + }; + /** + * Ad disabled date in ISO 8601 format. + */ + disabled_at?: string | null; + /** + * Ad creation date in ISO 8601 format. + */ + created_at?: string; + /** + * Ad last update date in ISO 8601 format. + */ + updated_at?: string; + /** + * Ad deletion date in ISO 8601 format. + */ + deleted_at?: string | null; + /** + * Ad status. + */ + status?: string; + /** + * Ad internal ID. + */ + aid?: number; + /** + * Asset type (for example, `image`, `video`). + */ + asset_type?: string; + /** + * Whether the ad is active. + */ + active?: boolean; + /** + * Associated product identifier (when applicable). + */ + product_id?: string | null; + /** + * Associated product SKU (when applicable). + */ + product_sku?: string | null; + /** + * Product name (when applicable). + */ + name?: string | null; + /** + * Product image URL (when applicable). + */ + image_url?: string | null; + /** + * Ad categories array (when applicable). + */ + categories?: Array; + /** + * Associated campaign name. + */ + campaign_name?: string; + /** + * Advertisement type. + */ + ad_type?: string; + /** + * Associated campaign status. + */ + campaign_status?: string; + /** + * Associated campaign settings. The fields are dynamic and may vary depending on the campaign type. + */ + campaign_settings?: { + /** + * Daily budget amount. + */ + daily_budget?: number; + /** + * Cost per mille value. + */ + cpm?: number; + /** + * Budget distribution type. + */ + budget_type?: string; + }; + /** + * Publisher identifier. + */ + publisher_id?: string; + /** + * Advertiser identifier. + */ + advertiser_id?: string; + /** + * Advertiser name. + */ + advertiser_name?: string; + /** + * Advertiser account identifier. + */ + advertiser_account_id?: string; + /** + * Publisher name. + */ + publisher_name?: string; + /** + * Publisher account identifier. + */ + publisher_account_id?: string; + /** + * Unique identifier of the ad. + */ + ad_id?: string; + /** + * Total quantity of conversions. + */ + conversions_quantity?: string; + /** + * Whether the ad is currently running. + */ + is_running?: boolean; + /** + * Tags associated with the advertiser. + */ + advertiser_tags?: Array | null; + /** + * Pending operations awaiting review for this campaign/ad. Empty when there is nothing pending. + */ + pending?: Array<{ + /** + * Type of pending operation. Currently, only `ads` is returned, indicating ads awaiting review. + */ + label?: 'ads'; + /** + * Number of pending items of the given `label`. + */ + quantity?: number; + }>; + /** + * Ad performance metrics object. All metric values are returned as strings regardless of their numeric nature. + */ + metrics?: { + /** + * Total number of clicks. + */ + clicks?: string; + /** + * Total number of conversions. + */ + conversions?: string; + /** + * Total quantity of items across all ad-driven conversions. Sums the quantities of every item in each conversion event (for example, if a shopper buys two units of a product after clicking an ad, this metric increases by 2). + */ + total_conversions_items_quantity?: string; + /** + * Total number of impressions. + */ + impressions?: string; + /** + * Total number of views. + */ + views?: string; + /** + * Number of conversions attributed to clicks. + */ + conversions_click?: string; + /** + * Number of conversions attributed to views. + */ + conversions_view?: string; + /** + * Consolidated conversion rate percentage, calculated as total conversions divided by the sum of clicks and views (`total_conversions / (total_clicks + total_views)`). This is the default conversion rate and considers both click- and view-attributed conversions. + */ + conversion_rate?: string; + /** + * Conversion rate percentage considering click-attributed conversions only, calculated as `conversions_click / total_clicks`. + */ + conversion_rate_click?: string; + /** + * Conversion rate percentage considering view-attributed conversions only, calculated as `conversions_view / total_views`. + */ + conversion_rate_view?: string; + /** + * Click-through rate percentage. + */ + ctr?: string; + /** + * Consolidated return on ad spend, combining click- and view-attributed revenue across all ad formats. + */ + roas?: string; + /** + * Return on ad spend calculated using click-attributed revenue only. + */ + roas_click?: string; + /** + * Return on ad spend calculated using view-attributed revenue only. + */ + roas_view?: string; + /** + * Halo return on ad spend: incremental revenue from non-advertised products purchased in the same order as advertised products (the halo effect), divided by ad spend. + */ + roas_halo?: string; + /** + * Total return on ad spend, combining direct revenue from the advertised product with halo revenue from other products in the same order, divided by the ad investment. Measures the campaign's total impact on the whole order. + */ + roas_overall?: string; + /** + * Ad cost percentage. + */ + adcost?: string; + /** + * Total income generated. + */ + income?: string; + /** + * Total amount spent. + */ + total_spent?: string; + /** + * Effective cost per mille (CPM). + */ + ecpm?: string; + /** + * Cost per acquisition. + */ + cpa?: string; + /** + * Average cost per click. + */ + avg_cpc?: string; + /** + * Average cost per mille. + */ + avg_cpm?: string; + /** + * Incremental revenue from non-advertised products that were purchased in the same order as an advertised product, attributed to the ad's spillover (halo) effect. + */ + halo_revenue?: string; + /** + * Number of orders with at least one halo item. + */ + halo_orders?: string; + /** + * Quantity of halo items sold. + */ + halo_items?: string; + }; + }>; + }; +}; + +export type GetAdResultsV2Response = GetAdResultsV2Responses[keyof GetAdResultsV2Responses]; + +export type PostWebhookMarketplaceTransfersByPublisherIdData = { + body?: { + /** + * Identifier of the transfer transaction returned by the marketplace when the transfer was requested. + */ + transaction_id: string; + /** + * Final status of the transfer. + */ + status: 'success' | 'failure'; + /** + * Description of the failure reason. Required when `status` is `failure`. + */ + message?: string; + }; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation Accept Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path: { + /** + * Publisher identifier provided by your account manager. + */ + publisher_id: string; + }; + query?: never; + url: '/webhook/marketplace/transfers/{publisher_id}'; +}; + +export type PostWebhookMarketplaceTransfersByPublisherIdErrors = { + /** + * Unauthorized + * + * Missing or invalid authentication credentials. + */ + 401: unknown; +}; + +export type PostWebhookMarketplaceTransfersByPublisherIdResponses = { + /** + * No Content + * + * Notification accepted. + */ + 204: void; +}; + +export type PostWebhookMarketplaceTransfersByPublisherIdResponse = PostWebhookMarketplaceTransfersByPublisherIdResponses[keyof PostWebhookMarketplaceTransfersByPublisherIdResponses]; + +export type PostAudienceUploadUrlData = { + body?: never; + headers: { + /** + * HTTP Client Negotiation Accept Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path?: never; + query?: never; + url: '/audience/upload-url'; +}; + +export type PostAudienceUploadUrlErrors = { + /** + * Unauthorized + * + * Missing or invalid authentication credentials. + */ + 401: unknown; +}; + +export type PostAudienceUploadUrlResponses = { + /** + * OK + * + * Presigned upload URL generated successfully. + */ + 200: { + /** + * Amazon S3 endpoint the publisher must send the multipart upload request to. + */ + url?: string; + /** + * Signed Amazon S3 form fields that must be included in the upload request, before the `file` field. + */ + fields?: { + [key: string]: string; + }; + /** + * Object key the file will be stored under. Generated by the backend from the authenticated publisher. + */ + key?: string; + /** + * Name of the Amazon S3 bucket that receives the upload. + */ + bucket?: string; + /** + * Number of seconds the pre-signed `POST` remains valid. + */ + expires_in?: number; + /** + * Maximum file size, in bytes, accepted by Amazon S3. Larger files are rejected. + */ + max_bytes?: number; + /** + * Hints describing how to perform the follow-up upload request. + */ + upload?: { + /** + * HTTP method to use for the upload request. + */ + method?: string; + /** + * Encoding type to use for the upload request. + */ + enctype?: string; + }; + }; +}; + +export type PostAudienceUploadUrlResponse = PostAudienceUploadUrlResponses[keyof PostAudienceUploadUrlResponses]; + +export type PostSsoMarketplaceData = { + body?: { + /** + * User identification token generated by the marketplace. + */ + sso_token: string; + /** + * Seller user's email address. + */ + email: string; + /** + * Unique identifier of the user in the marketplace. + */ + user_id: string; + /** + * Seller user's name. + */ + name: string; + /** + * Name of the marketplace. + */ + marketplace_name: string; + }; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation Accept Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path?: never; + query?: never; + url: '/sso/marketplace'; +}; + +export type PostSsoMarketplaceErrors = { + /** + * Unauthorized + * + * Missing or invalid authentication credentials. + */ + 401: unknown; +}; + +export type PostSsoMarketplaceResponses = { + /** + * OK + * + * Redirect URL generated successfully. + */ + 200: { + /** + * Redirect URL the seller user must follow to access the VTEX Ads platform. + */ + redirect_url?: string; + }; +}; + +export type PostSsoMarketplaceResponse = PostSsoMarketplaceResponses[keyof PostSsoMarketplaceResponses]; diff --git a/vtex/server/generated/ads/zod.gen.ts b/vtex/server/generated/ads/zod.gen.ts index 6b93e195..86e64f4e 100644 --- a/vtex/server/generated/ads/zod.gen.ts +++ b/vtex/server/generated/ads/zod.gen.ts @@ -12,6 +12,46 @@ export const zContentType = z.string(); */ export const zAccept = z.string(); +/** + * Start date for metrics in `YYYY-MM-DD` format. + */ +export const zStartDate = z.iso.date(); + +/** + * End date for metrics in `YYYY-MM-DD` format. + */ +export const zEndDate = z.iso.date(); + +/** + * Page number of the results. + */ +export const zPage = z.int().default(1); + +/** + * Number of items per page. When `download=true`, the BFF requests up to `20000` rows for XLSX generation. + */ +export const zQuantity = z.int().default(100); + +/** + * If `true`, returns the total number of available records. + */ +export const zCount = z.boolean().default(false); + +/** + * If `true`, includes detailed account information in the result. + */ +export const zAccountInfo = z.boolean().default(false); + +/** + * If `true`, returns an XLSX file buffer for download instead of JSON. + */ +export const zDownload = z.boolean().default(false); + +/** + * Sort direction. + */ +export const zOrderDirection = z.enum(['asc', 'desc']); + export const zPostProductBulkProductsData = z.object({ body: z.optional(z.array(z.object({ product_sku: z.string(), @@ -40,7 +80,8 @@ export const zPostProductBulkInventoriesData = z.object({ store_id: z.optional(z.string()), price: z.number(), promotional_price: z.number(), - is_available: z.boolean() + is_available: z.boolean(), + metadata: z.optional(z.record(z.string(), z.unknown())) })).max(500)), path: z.optional(z.never()), query: z.optional(z.never()), @@ -51,10 +92,13 @@ export const zPostProductBulkInventoriesData = z.object({ }); export const zPostV1BeaconImpressionByAdIdData = z.object({ - body: z.optional(z.object({ + body: z.optional(z.intersection(z.union([ + z.record(z.string(), z.unknown()), + z.record(z.string(), z.unknown()) + ]), z.object({ user_id: z.optional(z.string()), - session_id: z.string() - })), + session_id: z.optional(z.string()) + }))), path: z.object({ ad_id: z.string() }), @@ -68,10 +112,13 @@ export const zPostV1BeaconImpressionByAdIdData = z.object({ }); export const zPostV1BeaconClickByAdIdData = z.object({ - body: z.optional(z.object({ + body: z.optional(z.intersection(z.union([ + z.record(z.string(), z.unknown()), + z.record(z.string(), z.unknown()) + ]), z.object({ user_id: z.optional(z.string()), - session_id: z.string() - })), + session_id: z.optional(z.string()) + }))), path: z.object({ ad_id: z.string() }), @@ -85,10 +132,13 @@ export const zPostV1BeaconClickByAdIdData = z.object({ }); export const zPostV1BeaconViewByAdIdData = z.object({ - body: z.optional(z.object({ + body: z.optional(z.intersection(z.union([ + z.record(z.string(), z.unknown()), + z.record(z.string(), z.unknown()) + ]), z.object({ user_id: z.optional(z.string()), - session_id: z.string() - })), + session_id: z.optional(z.string()) + }))), path: z.object({ ad_id: z.string() }), @@ -103,7 +153,8 @@ export const zPostV1BeaconViewByAdIdData = z.object({ export const zPostV1BeaconConversionData = z.object({ body: z.optional(z.object({ - channel: z.optional(z.string()), + channel: z.string(), + brand: z.optional(z.string()), publisher_id: z.string(), user_id: z.string(), session_id: z.string(), @@ -168,7 +219,7 @@ export const zPostV1RmaByPublisherIdData = z.object({ 'sponsored_brand', 'digital_signage' ])), - asset_types: z.optional(z.array(z.enum(['image', 'video']))), + assets_type: z.optional(z.array(z.enum(['image', 'video']))), allow_sku_duplications: z.optional(z.boolean()) })), product_attributes: z.optional(z.object({ @@ -209,3 +260,358 @@ export const zPostV1RmaByPublisherIdData = z.object({ Accept: z.string() }) }); + +export const zGetReportV2AdvertisersData = z.object({ + body: z.optional(z.never()), + path: z.optional(z.never()), + query: z.object({ + start_date: z.iso.date(), + end_date: z.iso.date(), + account_info: z.optional(z.boolean()).default(false), + page: z.optional(z.int()).default(1), + quantity: z.optional(z.int()).default(100), + count: z.optional(z.boolean()).default(false), + download: z.optional(z.boolean()).default(false) + }), + headers: z.object({ + 'Content-Type': z.string(), + Accept: z.string() + }) +}); + +export const zGetReportV2PublishersData = z.object({ + body: z.optional(z.never()), + path: z.optional(z.never()), + query: z.object({ + start_date: z.iso.date(), + end_date: z.iso.date(), + publisher_name: z.optional(z.string()), + account_info: z.optional(z.boolean()).default(false), + page: z.optional(z.int()).default(1), + quantity: z.optional(z.int()).default(100), + count: z.optional(z.boolean()).default(false), + order_by: z.optional(z.enum([ + 'name', + 'balance', + 'total_daily_budget', + 'total_campaigns', + 'impressions', + 'clicks', + 'ctr', + 'total_spent', + 'conversions', + 'conversion_rate', + 'income', + 'roas' + ])), + order_direction: z.optional(z.enum(['asc', 'desc'])), + download: z.optional(z.boolean()).default(false) + }), + headers: z.object({ + 'Content-Type': z.string(), + Accept: z.string() + }) +}); + +export const zGetReportNetworkPublishersData = z.object({ + body: z.optional(z.never()), + path: z.optional(z.never()), + query: z.object({ + start_date: z.iso.date(), + end_date: z.iso.date(), + publisher_name: z.optional(z.string()), + account_info: z.optional(z.boolean()).default(false), + page: z.optional(z.int()).default(1), + quantity: z.optional(z.int()).default(100), + count: z.optional(z.boolean()).default(false), + order_by: z.optional(z.enum([ + 'name', + 'impressions', + 'clicks', + 'ctr', + 'conversions', + 'conversion_rate', + 'income', + 'roas', + 'requests' + ])), + order_direction: z.optional(z.enum(['asc', 'desc'])), + download: z.optional(z.boolean()).default(false) + }), + headers: z.object({ + 'Content-Type': z.string(), + Accept: z.string() + }) +}); + +export const zGetCampaignV2Data = z.object({ + body: z.optional(z.never()), + path: z.optional(z.never()), + query: z.object({ + start_date: z.iso.date(), + end_date: z.iso.date(), + status: z.optional(z.string()), + advertiser_id: z.optional(z.string()), + ad_type: z.optional(z.enum([ + 'banner', + 'product', + 'sponsored_brand', + 'digital_signage' + ])), + name: z.optional(z.string()), + account_info: z.optional(z.boolean()).default(false), + page: z.optional(z.int()).default(1), + quantity: z.optional(z.int()).default(100), + count: z.optional(z.boolean()).default(false), + order_by: z.optional(z.enum([ + 'name', + 'impressions', + 'clicks', + 'ctr', + 'conversions', + 'conversion_rate', + 'income', + 'roas', + 'created_at', + 'start_at', + 'daily_budget', + 'ad_type', + 'advertiser_name', + 'status' + ])), + order_direction: z.optional(z.enum(['asc', 'desc'])), + download: z.optional(z.boolean()).default(false) + }), + headers: z.object({ + 'Content-Type': z.string(), + Accept: z.string() + }) +}); + +export const zGetCampaignByCampaignIdData = z.object({ + body: z.optional(z.never()), + path: z.object({ + campaign_id: z.string() + }), + query: z.object({ + start_date: z.iso.date(), + end_date: z.iso.date() + }), + headers: z.object({ + 'Content-Type': z.string(), + Accept: z.string() + }) +}); + +export const zGetReportAdvertisersCampaignsDetailedData = z.object({ + body: z.optional(z.never()), + path: z.optional(z.never()), + query: z.object({ + start_date: z.iso.date(), + end_date: z.iso.date(), + campaign_id: z.optional(z.string()), + campaign_status: z.optional(z.string()), + publisher_id: z.optional(z.string()), + publisher_name: z.optional(z.string()), + ad_type: z.optional(z.enum([ + 'banner', + 'product', + 'sponsored_brand', + 'digital_signage' + ])), + ad_status: z.optional(z.enum([ + 'enabled', + 'paused', + 'rejected', + 'pending_review', + 'stock_out', + 'invalid_cost' + ])), + seller_id: z.optional(z.string()), + tag_id: z.optional(z.string()), + targeting_type: z.optional(z.string()), + sub_publisher_id: z.optional(z.string()), + sub_publisher_name: z.optional(z.string()), + page: z.optional(z.int()).default(1), + quantity: z.optional(z.int()).default(100), + count: z.optional(z.boolean()).default(true), + order_by: z.optional(z.enum([ + 'advertiser_name', + 'name', + 'ad_type', + 'status', + 'sub_publisher_name', + 'daily_budget', + 'impressions', + 'views', + 'clicks', + 'ctr', + 'total_spent', + 'conversions', + 'conversion_rate', + 'income', + 'roas', + 'created_at', + 'start_at' + ])), + order_direction: z.optional(z.enum(['asc', 'desc'])), + download: z.optional(z.boolean()).default(false) + }), + headers: z.object({ + 'Content-Type': z.string(), + Accept: z.string() + }) +}); + +export const zGetReportAdvertisersAdsDetailedData = z.object({ + body: z.optional(z.never()), + path: z.optional(z.never()), + query: z.object({ + start_date: z.iso.date(), + end_date: z.iso.date(), + campaign_name: z.optional(z.string()), + campaign_id: z.optional(z.string()), + publisher_id: z.optional(z.string()), + advertiser_id: z.optional(z.string()), + product_sku: z.optional(z.string()), + ad_status: z.optional(z.enum([ + 'enabled', + 'paused', + 'rejected', + 'pending_review', + 'stock_out', + 'invalid_cost' + ])), + ad_type: z.optional(z.enum([ + 'banner', + 'product', + 'sponsored_brand', + 'digital_signage' + ])), + targeting_type: z.optional(z.string()), + tag_id: z.optional(z.string()), + sub_publisher_id: z.optional(z.string()), + sub_publisher_name: z.optional(z.string()), + show_inactive: z.optional(z.boolean()).default(false), + hide_pending_rejected: z.optional(z.boolean()).default(false), + page: z.optional(z.int()).default(1), + quantity: z.optional(z.int()).default(100), + count: z.optional(z.boolean()).default(true), + order_by: z.optional(z.enum([ + 'ad_type', + 'ad_status', + 'impressions', + 'conversion_rate', + 'ctr', + 'income', + 'total_spent', + 'roas', + 'conversions', + 'total_conversions_items_quantity', + 'advertiser_name', + 'campaign_name', + 'clicks', + 'adcost', + 'created_at', + 'sub_publisher_name' + ])), + order_direction: z.optional(z.enum(['asc', 'desc'])), + download: z.optional(z.boolean()).default(false) + }), + headers: z.object({ + 'Content-Type': z.string(), + Accept: z.string() + }) +}); + +export const zGetAdResultsV2Data = z.object({ + body: z.optional(z.never()), + path: z.optional(z.never()), + query: z.object({ + start_date: z.iso.date(), + end_date: z.iso.date(), + campaign_name: z.optional(z.string()), + campaign_id: z.optional(z.string()), + advertiser_id: z.optional(z.string()), + product_sku: z.optional(z.string()), + ad_status: z.optional(z.enum([ + 'enabled', + 'paused', + 'rejected', + 'pending_review', + 'stock_out', + 'invalid_cost' + ])), + ad_type: z.optional(z.enum([ + 'banner', + 'product', + 'sponsored_brand', + 'digital_signage' + ])), + targeting_type: z.optional(z.string()), + show_inactive: z.optional(z.boolean()).default(false), + account_info: z.optional(z.boolean()).default(false), + page: z.optional(z.int()).default(1), + quantity: z.optional(z.int()).default(100), + count: z.optional(z.boolean()).default(false), + order_by: z.optional(z.enum([ + 'ad_type', + 'ad_status', + 'impressions', + 'conversion_rate', + 'ctr', + 'income', + 'total_spent', + 'roas', + 'conversions', + 'total_conversions_item_quantity' + ])), + order_direction: z.optional(z.enum(['asc', 'desc'])), + download: z.optional(z.boolean()).default(false) + }), + headers: z.object({ + 'Content-Type': z.string(), + Accept: z.string() + }) +}); + +export const zPostWebhookMarketplaceTransfersByPublisherIdData = z.object({ + body: z.optional(z.object({ + transaction_id: z.string(), + status: z.enum(['success', 'failure']), + message: z.optional(z.string()) + })), + path: z.object({ + publisher_id: z.string() + }), + query: z.optional(z.never()), + headers: z.object({ + 'Content-Type': z.string(), + Accept: z.string() + }) +}); + +export const zPostAudienceUploadUrlData = z.object({ + body: z.optional(z.never()), + path: z.optional(z.never()), + query: z.optional(z.never()), + headers: z.object({ + Accept: z.string() + }) +}); + +export const zPostSsoMarketplaceData = z.object({ + body: z.optional(z.object({ + sso_token: z.string(), + email: z.string(), + user_id: z.string(), + name: z.string(), + marketplace_name: z.string() + })), + path: z.optional(z.never()), + query: z.optional(z.never()), + headers: z.object({ + 'Content-Type': z.string(), + Accept: z.string() + }) +}); diff --git a/vtex/server/generated/b2b-addresses/client.gen.ts b/vtex/server/generated/b2b-addresses/client.gen.ts new file mode 100644 index 00000000..cab3c701 --- /dev/null +++ b/vtex/server/generated/b2b-addresses/client.gen.ts @@ -0,0 +1,16 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { type ClientOptions, type Config, createClient, createConfig } from './client'; +import type { ClientOptions as ClientOptions2 } from './types.gen'; + +/** + * The `createClientConfig()` function will be called on client initialization + * and the returned object will become the client's initial configuration. + * + * You may want to initialize your client this way instead of calling + * `setConfig()`. This is useful for example if you're using Next.js + * to ensure your client always has the correct values. + */ +export type CreateClientConfig = (override?: Config) => Config & T>; + +export const client = createClient(createConfig()); diff --git a/vtex/server/generated/b2b-addresses/client/client.gen.ts b/vtex/server/generated/b2b-addresses/client/client.gen.ts new file mode 100644 index 00000000..d2e55a14 --- /dev/null +++ b/vtex/server/generated/b2b-addresses/client/client.gen.ts @@ -0,0 +1,288 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { createSseClient } from '../core/serverSentEvents.gen'; +import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; +import type { Client, Config, RequestOptions, ResolvedRequestOptions } from './types.gen'; +import { + buildUrl, + createConfig, + createInterceptors, + getParseAs, + mergeConfigs, + mergeHeaders, + setAuthParams, +} from './utils.gen'; + +type ReqInit = Omit & { + body?: any; + headers: ReturnType; +}; + +export const createClient = (config: Config = {}): Client => { + let _config = mergeConfigs(createConfig(), config); + + const getConfig = (): Config => ({ ..._config }); + + const setConfig = (config: Config): Config => { + _config = mergeConfigs(_config, config); + return getConfig(); + }; + + const interceptors = createInterceptors(); + + const beforeRequest = async (options: RequestOptions) => { + const opts = { + ..._config, + ...options, + fetch: options.fetch ?? _config.fetch ?? globalThis.fetch, + headers: mergeHeaders(_config.headers, options.headers), + serializedBody: undefined, + }; + + if (opts.security) { + await setAuthParams({ + ...opts, + security: opts.security, + }); + } + + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + + if (opts.body !== undefined && opts.bodySerializer) { + opts.serializedBody = opts.bodySerializer(opts.body); + } + + // remove Content-Type header if body is empty to avoid sending invalid requests + if (opts.body === undefined || opts.serializedBody === '') { + opts.headers.delete('Content-Type'); + } + + const url = buildUrl(opts); + + return { opts, url }; + }; + + const request: Client['request'] = async (options) => { + // @ts-expect-error + const { opts, url } = await beforeRequest(options); + const requestInit: ReqInit = { + redirect: 'follow', + ...opts, + body: getValidRequestBody(opts), + }; + + let request = new Request(url, requestInit); + + for (const fn of interceptors.request.fns) { + if (fn) { + request = await fn(request, opts); + } + } + + // fetch must be assigned here, otherwise it would throw the error: + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation + const _fetch = opts.fetch!; + let response: Response; + + try { + response = await _fetch(request); + } catch (error) { + // Handle fetch exceptions (AbortError, network errors, etc.) + let finalError = error; + + for (const fn of interceptors.error.fns) { + if (fn) { + finalError = (await fn(error, undefined as any, request, opts)) as unknown; + } + } + + finalError = finalError || ({} as unknown); + + if (opts.throwOnError) { + throw finalError; + } + + // Return error response + return opts.responseStyle === 'data' + ? undefined + : { + error: finalError, + request, + response: undefined as any, + }; + } + + for (const fn of interceptors.response.fns) { + if (fn) { + response = await fn(response, request, opts); + } + } + + const result = { + request, + response, + }; + + if (response.ok) { + const parseAs = + (opts.parseAs === 'auto' + ? getParseAs(response.headers.get('Content-Type')) + : opts.parseAs) ?? 'json'; + + if (response.status === 204 || response.headers.get('Content-Length') === '0') { + let emptyData: any; + switch (parseAs) { + case 'arrayBuffer': + case 'blob': + case 'text': + emptyData = await response[parseAs](); + break; + case 'formData': + emptyData = new FormData(); + break; + case 'stream': + emptyData = response.body; + break; + case 'json': + default: + emptyData = {}; + break; + } + return opts.responseStyle === 'data' + ? emptyData + : { + data: emptyData, + ...result, + }; + } + + let data: any; + switch (parseAs) { + case 'arrayBuffer': + case 'blob': + case 'formData': + case 'text': + data = await response[parseAs](); + break; + case 'json': { + // Some servers return 200 with no Content-Length and empty body. + // response.json() would throw; read as text and parse if non-empty. + const text = await response.text(); + data = text ? JSON.parse(text) : {}; + break; + } + case 'stream': + return opts.responseStyle === 'data' + ? response.body + : { + data: response.body, + ...result, + }; + } + + if (parseAs === 'json') { + if (opts.responseValidator) { + await opts.responseValidator(data); + } + + if (opts.responseTransformer) { + data = await opts.responseTransformer(data); + } + } + + return opts.responseStyle === 'data' + ? data + : { + data, + ...result, + }; + } + + const textError = await response.text(); + let jsonError: unknown; + + try { + jsonError = JSON.parse(textError); + } catch { + // noop + } + + const error = jsonError ?? textError; + let finalError = error; + + for (const fn of interceptors.error.fns) { + if (fn) { + finalError = (await fn(error, response, request, opts)) as string; + } + } + + finalError = finalError || ({} as string); + + if (opts.throwOnError) { + throw finalError; + } + + // TODO: we probably want to return error and improve types + return opts.responseStyle === 'data' + ? undefined + : { + error: finalError, + ...result, + }; + }; + + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => + request({ ...options, method }); + + const makeSseFn = (method: Uppercase) => async (options: RequestOptions) => { + const { opts, url } = await beforeRequest(options); + return createSseClient({ + ...opts, + body: opts.body as BodyInit | null | undefined, + headers: opts.headers as unknown as Record, + method, + onRequest: async (url, init) => { + let request = new Request(url, init); + for (const fn of interceptors.request.fns) { + if (fn) { + request = await fn(request, opts); + } + } + return request; + }, + serializedBody: getValidRequestBody(opts) as BodyInit | null | undefined, + url, + }); + }; + + return { + buildUrl, + connect: makeMethodFn('CONNECT'), + delete: makeMethodFn('DELETE'), + get: makeMethodFn('GET'), + getConfig, + head: makeMethodFn('HEAD'), + interceptors, + options: makeMethodFn('OPTIONS'), + patch: makeMethodFn('PATCH'), + post: makeMethodFn('POST'), + put: makeMethodFn('PUT'), + request, + setConfig, + sse: { + connect: makeSseFn('CONNECT'), + delete: makeSseFn('DELETE'), + get: makeSseFn('GET'), + head: makeSseFn('HEAD'), + options: makeSseFn('OPTIONS'), + patch: makeSseFn('PATCH'), + post: makeSseFn('POST'), + put: makeSseFn('PUT'), + trace: makeSseFn('TRACE'), + }, + trace: makeMethodFn('TRACE'), + } as Client; +}; diff --git a/vtex/server/generated/b2b-addresses/client/index.ts b/vtex/server/generated/b2b-addresses/client/index.ts new file mode 100644 index 00000000..b295edec --- /dev/null +++ b/vtex/server/generated/b2b-addresses/client/index.ts @@ -0,0 +1,25 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type { Auth } from '../core/auth.gen'; +export type { QuerySerializerOptions } from '../core/bodySerializer.gen'; +export { + formDataBodySerializer, + jsonBodySerializer, + urlSearchParamsBodySerializer, +} from '../core/bodySerializer.gen'; +export { buildClientParams } from '../core/params.gen'; +export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen'; +export { createClient } from './client.gen'; +export type { + Client, + ClientOptions, + Config, + CreateClientConfig, + Options, + RequestOptions, + RequestResult, + ResolvedRequestOptions, + ResponseStyle, + TDataShape, +} from './types.gen'; +export { createConfig, mergeHeaders } from './utils.gen'; diff --git a/vtex/server/generated/b2b-addresses/client/types.gen.ts b/vtex/server/generated/b2b-addresses/client/types.gen.ts new file mode 100644 index 00000000..cb6d0d54 --- /dev/null +++ b/vtex/server/generated/b2b-addresses/client/types.gen.ts @@ -0,0 +1,213 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Auth } from '../core/auth.gen'; +import type { + ServerSentEventsOptions, + ServerSentEventsResult, +} from '../core/serverSentEvents.gen'; +import type { Client as CoreClient, Config as CoreConfig } from '../core/types.gen'; +import type { Middleware } from './utils.gen'; + +export type ResponseStyle = 'data' | 'fields'; + +export interface Config + extends Omit, CoreConfig { + /** + * Base URL for all requests made by this client. + */ + baseUrl?: T['baseUrl']; + /** + * Fetch API implementation. You can use this option to provide a custom + * fetch instance. + * + * @default globalThis.fetch + */ + fetch?: typeof fetch; + /** + * Please don't use the Fetch client for Next.js applications. The `next` + * options won't have any effect. + * + * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead. + */ + next?: never; + /** + * Return the response data parsed in a specified format. By default, `auto` + * will infer the appropriate method from the `Content-Type` response header. + * You can override this behavior with any of the {@link Body} methods. + * Select `stream` if you don't want to parse response data at all. + * + * @default 'auto' + */ + parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text'; + /** + * Should we return only data or multiple fields (data, error, response, etc.)? + * + * @default 'fields' + */ + responseStyle?: ResponseStyle; + /** + * Throw an error instead of returning it in the response? + * + * @default false + */ + throwOnError?: T['throwOnError']; +} + +export interface RequestOptions< + TData = unknown, + TResponseStyle extends ResponseStyle = 'fields', + ThrowOnError extends boolean = boolean, + Url extends string = string, +> + extends + Config<{ + responseStyle: TResponseStyle; + throwOnError: ThrowOnError; + }>, + Pick< + ServerSentEventsOptions, + | 'onSseError' + | 'onSseEvent' + | 'sseDefaultRetryDelay' + | 'sseMaxRetryAttempts' + | 'sseMaxRetryDelay' + > { + /** + * Any body that you want to add to your request. + * + * {@link https://developer.mozilla.org/docs/Web/API/fetch#body} + */ + body?: unknown; + path?: Record; + query?: Record; + /** + * Security mechanism(s) to use for the request. + */ + security?: ReadonlyArray; + url: Url; +} + +export interface ResolvedRequestOptions< + TResponseStyle extends ResponseStyle = 'fields', + ThrowOnError extends boolean = boolean, + Url extends string = string, +> extends RequestOptions { + serializedBody?: string; +} + +export type RequestResult< + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = boolean, + TResponseStyle extends ResponseStyle = 'fields', +> = ThrowOnError extends true + ? Promise< + TResponseStyle extends 'data' + ? TData extends Record + ? TData[keyof TData] + : TData + : { + data: TData extends Record ? TData[keyof TData] : TData; + request: Request; + response: Response; + } + > + : Promise< + TResponseStyle extends 'data' + ? (TData extends Record ? TData[keyof TData] : TData) | undefined + : ( + | { + data: TData extends Record ? TData[keyof TData] : TData; + error: undefined; + } + | { + data: undefined; + error: TError extends Record ? TError[keyof TError] : TError; + } + ) & { + request: Request; + response: Response; + } + >; + +export interface ClientOptions { + baseUrl?: string; + responseStyle?: ResponseStyle; + throwOnError?: boolean; +} + +type MethodFn = < + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = false, + TResponseStyle extends ResponseStyle = 'fields', +>( + options: Omit, 'method'>, +) => RequestResult; + +type SseFn = < + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = false, + TResponseStyle extends ResponseStyle = 'fields', +>( + options: Omit, 'method'>, +) => Promise>; + +type RequestFn = < + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = false, + TResponseStyle extends ResponseStyle = 'fields', +>( + options: Omit, 'method'> & + Pick>, 'method'>, +) => RequestResult; + +type BuildUrlFn = < + TData extends { + body?: unknown; + path?: Record; + query?: Record; + url: string; + }, +>( + options: TData & Options, +) => string; + +export type Client = CoreClient & { + interceptors: Middleware; +}; + +/** + * The `createClientConfig()` function will be called on client initialization + * and the returned object will become the client's initial configuration. + * + * You may want to initialize your client this way instead of calling + * `setConfig()`. This is useful for example if you're using Next.js + * to ensure your client always has the correct values. + */ +export type CreateClientConfig = ( + override?: Config, +) => Config & T>; + +export interface TDataShape { + body?: unknown; + headers?: unknown; + path?: unknown; + query?: unknown; + url: string; +} + +type OmitKeys = Pick>; + +export type Options< + TData extends TDataShape = TDataShape, + ThrowOnError extends boolean = boolean, + TResponse = unknown, + TResponseStyle extends ResponseStyle = 'fields', +> = OmitKeys< + RequestOptions, + 'body' | 'path' | 'query' | 'url' +> & + ([TData] extends [never] ? unknown : Omit); diff --git a/vtex/server/generated/b2b-addresses/client/utils.gen.ts b/vtex/server/generated/b2b-addresses/client/utils.gen.ts new file mode 100644 index 00000000..b4bd2435 --- /dev/null +++ b/vtex/server/generated/b2b-addresses/client/utils.gen.ts @@ -0,0 +1,316 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { getAuthToken } from '../core/auth.gen'; +import type { QuerySerializerOptions } from '../core/bodySerializer.gen'; +import { jsonBodySerializer } from '../core/bodySerializer.gen'; +import { + serializeArrayParam, + serializeObjectParam, + serializePrimitiveParam, +} from '../core/pathSerializer.gen'; +import { getUrl } from '../core/utils.gen'; +import type { Client, ClientOptions, Config, RequestOptions } from './types.gen'; + +export const createQuerySerializer = ({ + parameters = {}, + ...args +}: QuerySerializerOptions = {}) => { + const querySerializer = (queryParams: T) => { + const search: string[] = []; + if (queryParams && typeof queryParams === 'object') { + for (const name in queryParams) { + const value = queryParams[name]; + + if (value === undefined || value === null) { + continue; + } + + const options = parameters[name] || args; + + if (Array.isArray(value)) { + const serializedArray = serializeArrayParam({ + allowReserved: options.allowReserved, + explode: true, + name, + style: 'form', + value, + ...options.array, + }); + if (serializedArray) search.push(serializedArray); + } else if (typeof value === 'object') { + const serializedObject = serializeObjectParam({ + allowReserved: options.allowReserved, + explode: true, + name, + style: 'deepObject', + value: value as Record, + ...options.object, + }); + if (serializedObject) search.push(serializedObject); + } else { + const serializedPrimitive = serializePrimitiveParam({ + allowReserved: options.allowReserved, + name, + value: value as string, + }); + if (serializedPrimitive) search.push(serializedPrimitive); + } + } + } + return search.join('&'); + }; + return querySerializer; +}; + +/** + * Infers parseAs value from provided Content-Type header. + */ +export const getParseAs = (contentType: string | null): Exclude => { + if (!contentType) { + // If no Content-Type header is provided, the best we can do is return the raw response body, + // which is effectively the same as the 'stream' option. + return 'stream'; + } + + const cleanContent = contentType.split(';')[0]?.trim(); + + if (!cleanContent) { + return; + } + + if (cleanContent.startsWith('application/json') || cleanContent.endsWith('+json')) { + return 'json'; + } + + if (cleanContent === 'multipart/form-data') { + return 'formData'; + } + + if ( + ['application/', 'audio/', 'image/', 'video/'].some((type) => cleanContent.startsWith(type)) + ) { + return 'blob'; + } + + if (cleanContent.startsWith('text/')) { + return 'text'; + } + + return; +}; + +const checkForExistence = ( + options: Pick & { + headers: Headers; + }, + name?: string, +): boolean => { + if (!name) { + return false; + } + if ( + options.headers.has(name) || + options.query?.[name] || + options.headers.get('Cookie')?.includes(`${name}=`) + ) { + return true; + } + return false; +}; + +export const setAuthParams = async ({ + security, + ...options +}: Pick, 'security'> & + Pick & { + headers: Headers; + }) => { + for (const auth of security) { + if (checkForExistence(options, auth.name)) { + continue; + } + + const token = await getAuthToken(auth, options.auth); + + if (!token) { + continue; + } + + const name = auth.name ?? 'Authorization'; + + switch (auth.in) { + case 'query': + if (!options.query) { + options.query = {}; + } + options.query[name] = token; + break; + case 'cookie': + options.headers.append('Cookie', `${name}=${token}`); + break; + case 'header': + default: + options.headers.set(name, token); + break; + } + } +}; + +export const buildUrl: Client['buildUrl'] = (options) => + getUrl({ + baseUrl: options.baseUrl as string, + path: options.path, + query: options.query, + querySerializer: + typeof options.querySerializer === 'function' + ? options.querySerializer + : createQuerySerializer(options.querySerializer), + url: options.url, + }); + +export const mergeConfigs = (a: Config, b: Config): Config => { + const config = { ...a, ...b }; + if (config.baseUrl?.endsWith('/')) { + config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1); + } + config.headers = mergeHeaders(a.headers, b.headers); + return config; +}; + +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + +export const mergeHeaders = ( + ...headers: Array['headers'] | undefined> +): Headers => { + const mergedHeaders = new Headers(); + for (const header of headers) { + if (!header) { + continue; + } + + const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header); + + for (const [key, value] of iterator) { + if (value === null) { + mergedHeaders.delete(key); + } else if (Array.isArray(value)) { + for (const v of value) { + mergedHeaders.append(key, v as string); + } + } else if (value !== undefined) { + // assume object headers are meant to be JSON stringified, i.e. their + // content value in OpenAPI specification is 'application/json' + mergedHeaders.set( + key, + typeof value === 'object' ? JSON.stringify(value) : (value as string), + ); + } + } + } + return mergedHeaders; +}; + +type ErrInterceptor = ( + error: Err, + response: Res, + request: Req, + options: Options, +) => Err | Promise; + +type ReqInterceptor = (request: Req, options: Options) => Req | Promise; + +type ResInterceptor = ( + response: Res, + request: Req, + options: Options, +) => Res | Promise; + +class Interceptors { + fns: Array = []; + + clear(): void { + this.fns = []; + } + + eject(id: number | Interceptor): void { + const index = this.getInterceptorIndex(id); + if (this.fns[index]) { + this.fns[index] = null; + } + } + + exists(id: number | Interceptor): boolean { + const index = this.getInterceptorIndex(id); + return Boolean(this.fns[index]); + } + + getInterceptorIndex(id: number | Interceptor): number { + if (typeof id === 'number') { + return this.fns[id] ? id : -1; + } + return this.fns.indexOf(id); + } + + update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false { + const index = this.getInterceptorIndex(id); + if (this.fns[index]) { + this.fns[index] = fn; + return id; + } + return false; + } + + use(fn: Interceptor): number { + this.fns.push(fn); + return this.fns.length - 1; + } +} + +export interface Middleware { + error: Interceptors>; + request: Interceptors>; + response: Interceptors>; +} + +export const createInterceptors = (): Middleware< + Req, + Res, + Err, + Options +> => ({ + error: new Interceptors>(), + request: new Interceptors>(), + response: new Interceptors>(), +}); + +const defaultQuerySerializer = createQuerySerializer({ + allowReserved: false, + array: { + explode: true, + style: 'form', + }, + object: { + explode: true, + style: 'deepObject', + }, +}); + +const defaultHeaders = { + 'Content-Type': 'application/json', +}; + +export const createConfig = ( + override: Config & T> = {}, +): Config & T> => ({ + ...jsonBodySerializer, + headers: defaultHeaders, + parseAs: 'auto', + querySerializer: defaultQuerySerializer, + ...override, +}); diff --git a/vtex/server/generated/b2b-addresses/core/auth.gen.ts b/vtex/server/generated/b2b-addresses/core/auth.gen.ts new file mode 100644 index 00000000..3ebf9947 --- /dev/null +++ b/vtex/server/generated/b2b-addresses/core/auth.gen.ts @@ -0,0 +1,41 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type AuthToken = string | undefined; + +export interface Auth { + /** + * Which part of the request do we use to send the auth? + * + * @default 'header' + */ + in?: 'header' | 'query' | 'cookie'; + /** + * Header or query parameter name. + * + * @default 'Authorization' + */ + name?: string; + scheme?: 'basic' | 'bearer'; + type: 'apiKey' | 'http'; +} + +export const getAuthToken = async ( + auth: Auth, + callback: ((auth: Auth) => Promise | AuthToken) | AuthToken, +): Promise => { + const token = typeof callback === 'function' ? await callback(auth) : callback; + + if (!token) { + return; + } + + if (auth.scheme === 'bearer') { + return `Bearer ${token}`; + } + + if (auth.scheme === 'basic') { + return `Basic ${btoa(token)}`; + } + + return token; +}; diff --git a/vtex/server/generated/b2b-addresses/core/bodySerializer.gen.ts b/vtex/server/generated/b2b-addresses/core/bodySerializer.gen.ts new file mode 100644 index 00000000..8ad92c9f --- /dev/null +++ b/vtex/server/generated/b2b-addresses/core/bodySerializer.gen.ts @@ -0,0 +1,84 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { ArrayStyle, ObjectStyle, SerializerOptions } from './pathSerializer.gen'; + +export type QuerySerializer = (query: Record) => string; + +export type BodySerializer = (body: any) => any; + +type QuerySerializerOptionsObject = { + allowReserved?: boolean; + array?: Partial>; + object?: Partial>; +}; + +export type QuerySerializerOptions = QuerySerializerOptionsObject & { + /** + * Per-parameter serialization overrides. When provided, these settings + * override the global array/object settings for specific parameter names. + */ + parameters?: Record; +}; + +const serializeFormDataPair = (data: FormData, key: string, value: unknown): void => { + if (typeof value === 'string' || value instanceof Blob) { + data.append(key, value); + } else if (value instanceof Date) { + data.append(key, value.toISOString()); + } else { + data.append(key, JSON.stringify(value)); + } +}; + +const serializeUrlSearchParamsPair = (data: URLSearchParams, key: string, value: unknown): void => { + if (typeof value === 'string') { + data.append(key, value); + } else { + data.append(key, JSON.stringify(value)); + } +}; + +export const formDataBodySerializer = { + bodySerializer: | Array>>( + body: T, + ): FormData => { + const data = new FormData(); + + Object.entries(body).forEach(([key, value]) => { + if (value === undefined || value === null) { + return; + } + if (Array.isArray(value)) { + value.forEach((v) => serializeFormDataPair(data, key, v)); + } else { + serializeFormDataPair(data, key, value); + } + }); + + return data; + }, +}; + +export const jsonBodySerializer = { + bodySerializer: (body: T): string => + JSON.stringify(body, (_key, value) => (typeof value === 'bigint' ? value.toString() : value)), +}; + +export const urlSearchParamsBodySerializer = { + bodySerializer: | Array>>(body: T): string => { + const data = new URLSearchParams(); + + Object.entries(body).forEach(([key, value]) => { + if (value === undefined || value === null) { + return; + } + if (Array.isArray(value)) { + value.forEach((v) => serializeUrlSearchParamsPair(data, key, v)); + } else { + serializeUrlSearchParamsPair(data, key, value); + } + }); + + return data.toString(); + }, +}; diff --git a/vtex/server/generated/b2b-addresses/core/params.gen.ts b/vtex/server/generated/b2b-addresses/core/params.gen.ts new file mode 100644 index 00000000..6099cab1 --- /dev/null +++ b/vtex/server/generated/b2b-addresses/core/params.gen.ts @@ -0,0 +1,169 @@ +// This file is auto-generated by @hey-api/openapi-ts + +type Slot = 'body' | 'headers' | 'path' | 'query'; + +export type Field = + | { + in: Exclude; + /** + * Field name. This is the name we want the user to see and use. + */ + key: string; + /** + * Field mapped name. This is the name we want to use in the request. + * If omitted, we use the same value as `key`. + */ + map?: string; + } + | { + in: Extract; + /** + * Key isn't required for bodies. + */ + key?: string; + map?: string; + } + | { + /** + * Field name. This is the name we want the user to see and use. + */ + key: string; + /** + * Field mapped name. This is the name we want to use in the request. + * If `in` is omitted, `map` aliases `key` to the transport layer. + */ + map: Slot; + }; + +export interface Fields { + allowExtra?: Partial>; + args?: ReadonlyArray; +} + +export type FieldsConfig = ReadonlyArray; + +const extraPrefixesMap: Record = { + $body_: 'body', + $headers_: 'headers', + $path_: 'path', + $query_: 'query', +}; +const extraPrefixes = Object.entries(extraPrefixesMap); + +type KeyMap = Map< + string, + | { + in: Slot; + map?: string; + } + | { + in?: never; + map: Slot; + } +>; + +const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { + if (!map) { + map = new Map(); + } + + for (const config of fields) { + if ('in' in config) { + if (config.key) { + map.set(config.key, { + in: config.in, + map: config.map, + }); + } + } else if ('key' in config) { + map.set(config.key, { + map: config.map, + }); + } else if (config.args) { + buildKeyMap(config.args, map); + } + } + + return map; +}; + +interface Params { + body: unknown; + headers: Record; + path: Record; + query: Record; +} + +const stripEmptySlots = (params: Params) => { + for (const [slot, value] of Object.entries(params)) { + if (value && typeof value === 'object' && !Object.keys(value).length) { + delete params[slot as Slot]; + } + } +}; + +export const buildClientParams = (args: ReadonlyArray, fields: FieldsConfig) => { + const params: Params = { + body: {}, + headers: {}, + path: {}, + query: {}, + }; + + const map = buildKeyMap(fields); + + let config: FieldsConfig[number] | undefined; + + for (const [index, arg] of args.entries()) { + if (fields[index]) { + config = fields[index]; + } + + if (!config) { + continue; + } + + if ('in' in config) { + if (config.key) { + const field = map.get(config.key)!; + const name = field.map || config.key; + if (field.in) { + (params[field.in] as Record)[name] = arg; + } + } else { + params.body = arg; + } + } else { + for (const [key, value] of Object.entries(arg ?? {})) { + const field = map.get(key); + + if (field) { + if (field.in) { + const name = field.map || key; + (params[field.in] as Record)[name] = value; + } else { + params[field.map] = value; + } + } else { + const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix)); + + if (extra) { + const [prefix, slot] = extra; + (params[slot] as Record)[key.slice(prefix.length)] = value; + } else if ('allowExtra' in config && config.allowExtra) { + for (const [slot, allowed] of Object.entries(config.allowExtra)) { + if (allowed) { + (params[slot as Slot] as Record)[key] = value; + break; + } + } + } + } + } + } + } + + stripEmptySlots(params); + + return params; +}; diff --git a/vtex/server/generated/b2b-addresses/core/pathSerializer.gen.ts b/vtex/server/generated/b2b-addresses/core/pathSerializer.gen.ts new file mode 100644 index 00000000..994b2848 --- /dev/null +++ b/vtex/server/generated/b2b-addresses/core/pathSerializer.gen.ts @@ -0,0 +1,171 @@ +// This file is auto-generated by @hey-api/openapi-ts + +interface SerializeOptions extends SerializePrimitiveOptions, SerializerOptions {} + +interface SerializePrimitiveOptions { + allowReserved?: boolean; + name: string; +} + +export interface SerializerOptions { + /** + * @default true + */ + explode: boolean; + style: T; +} + +export type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited'; +export type ArraySeparatorStyle = ArrayStyle | MatrixStyle; +type MatrixStyle = 'label' | 'matrix' | 'simple'; +export type ObjectStyle = 'form' | 'deepObject'; +type ObjectSeparatorStyle = ObjectStyle | MatrixStyle; + +interface SerializePrimitiveParam extends SerializePrimitiveOptions { + value: string; +} + +export const separatorArrayExplode = (style: ArraySeparatorStyle) => { + switch (style) { + case 'label': + return '.'; + case 'matrix': + return ';'; + case 'simple': + return ','; + default: + return '&'; + } +}; + +export const separatorArrayNoExplode = (style: ArraySeparatorStyle) => { + switch (style) { + case 'form': + return ','; + case 'pipeDelimited': + return '|'; + case 'spaceDelimited': + return '%20'; + default: + return ','; + } +}; + +export const separatorObjectExplode = (style: ObjectSeparatorStyle) => { + switch (style) { + case 'label': + return '.'; + case 'matrix': + return ';'; + case 'simple': + return ','; + default: + return '&'; + } +}; + +export const serializeArrayParam = ({ + allowReserved, + explode, + name, + style, + value, +}: SerializeOptions & { + value: unknown[]; +}) => { + if (!explode) { + const joinedValues = ( + allowReserved ? value : value.map((v) => encodeURIComponent(v as string)) + ).join(separatorArrayNoExplode(style)); + switch (style) { + case 'label': + return `.${joinedValues}`; + case 'matrix': + return `;${name}=${joinedValues}`; + case 'simple': + return joinedValues; + default: + return `${name}=${joinedValues}`; + } + } + + const separator = separatorArrayExplode(style); + const joinedValues = value + .map((v) => { + if (style === 'label' || style === 'simple') { + return allowReserved ? v : encodeURIComponent(v as string); + } + + return serializePrimitiveParam({ + allowReserved, + name, + value: v as string, + }); + }) + .join(separator); + return style === 'label' || style === 'matrix' ? separator + joinedValues : joinedValues; +}; + +export const serializePrimitiveParam = ({ + allowReserved, + name, + value, +}: SerializePrimitiveParam) => { + if (value === undefined || value === null) { + return ''; + } + + if (typeof value === 'object') { + throw new Error( + 'Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.', + ); + } + + return `${name}=${allowReserved ? value : encodeURIComponent(value)}`; +}; + +export const serializeObjectParam = ({ + allowReserved, + explode, + name, + style, + value, + valueOnly, +}: SerializeOptions & { + value: Record | Date; + valueOnly?: boolean; +}) => { + if (value instanceof Date) { + return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`; + } + + if (style !== 'deepObject' && !explode) { + let values: string[] = []; + Object.entries(value).forEach(([key, v]) => { + values = [...values, key, allowReserved ? (v as string) : encodeURIComponent(v as string)]; + }); + const joinedValues = values.join(','); + switch (style) { + case 'form': + return `${name}=${joinedValues}`; + case 'label': + return `.${joinedValues}`; + case 'matrix': + return `;${name}=${joinedValues}`; + default: + return joinedValues; + } + } + + const separator = separatorObjectExplode(style); + const joinedValues = Object.entries(value) + .map(([key, v]) => + serializePrimitiveParam({ + allowReserved, + name: style === 'deepObject' ? `${name}[${key}]` : key, + value: v as string, + }), + ) + .join(separator); + return style === 'label' || style === 'matrix' ? separator + joinedValues : joinedValues; +}; diff --git a/vtex/server/generated/b2b-addresses/core/queryKeySerializer.gen.ts b/vtex/server/generated/b2b-addresses/core/queryKeySerializer.gen.ts new file mode 100644 index 00000000..5000df60 --- /dev/null +++ b/vtex/server/generated/b2b-addresses/core/queryKeySerializer.gen.ts @@ -0,0 +1,117 @@ +// This file is auto-generated by @hey-api/openapi-ts + +/** + * JSON-friendly union that mirrors what Pinia Colada can hash. + */ +export type JsonValue = + | null + | string + | number + | boolean + | JsonValue[] + | { [key: string]: JsonValue }; + +/** + * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes. + */ +export const queryKeyJsonReplacer = (_key: string, value: unknown) => { + if (value === undefined || typeof value === 'function' || typeof value === 'symbol') { + return undefined; + } + if (typeof value === 'bigint') { + return value.toString(); + } + if (value instanceof Date) { + return value.toISOString(); + } + return value; +}; + +/** + * Safely stringifies a value and parses it back into a JsonValue. + */ +export const stringifyToJsonValue = (input: unknown): JsonValue | undefined => { + try { + const json = JSON.stringify(input, queryKeyJsonReplacer); + if (json === undefined) { + return undefined; + } + return JSON.parse(json) as JsonValue; + } catch { + return undefined; + } +}; + +/** + * Detects plain objects (including objects with a null prototype). + */ +const isPlainObject = (value: unknown): value is Record => { + if (value === null || typeof value !== 'object') { + return false; + } + const prototype = Object.getPrototypeOf(value as object); + return prototype === Object.prototype || prototype === null; +}; + +/** + * Turns URLSearchParams into a sorted JSON object for deterministic keys. + */ +const serializeSearchParams = (params: URLSearchParams): JsonValue => { + const entries = Array.from(params.entries()).sort(([a], [b]) => a.localeCompare(b)); + const result: Record = {}; + + for (const [key, value] of entries) { + const existing = result[key]; + if (existing === undefined) { + result[key] = value; + continue; + } + + if (Array.isArray(existing)) { + (existing as string[]).push(value); + } else { + result[key] = [existing, value]; + } + } + + return result; +}; + +/** + * Normalizes any accepted value into a JSON-friendly shape for query keys. + */ +export const serializeQueryKeyValue = (value: unknown): JsonValue | undefined => { + if (value === null) { + return null; + } + + if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { + return value; + } + + if (value === undefined || typeof value === 'function' || typeof value === 'symbol') { + return undefined; + } + + if (typeof value === 'bigint') { + return value.toString(); + } + + if (value instanceof Date) { + return value.toISOString(); + } + + if (Array.isArray(value)) { + return stringifyToJsonValue(value); + } + + if (typeof URLSearchParams !== 'undefined' && value instanceof URLSearchParams) { + return serializeSearchParams(value); + } + + if (isPlainObject(value)) { + return stringifyToJsonValue(value); + } + + return undefined; +}; diff --git a/vtex/server/generated/b2b-addresses/core/serverSentEvents.gen.ts b/vtex/server/generated/b2b-addresses/core/serverSentEvents.gen.ts new file mode 100644 index 00000000..6aa6cf02 --- /dev/null +++ b/vtex/server/generated/b2b-addresses/core/serverSentEvents.gen.ts @@ -0,0 +1,243 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Config } from './types.gen'; + +export type ServerSentEventsOptions = Omit & + Pick & { + /** + * Fetch API implementation. You can use this option to provide a custom + * fetch instance. + * + * @default globalThis.fetch + */ + fetch?: typeof fetch; + /** + * Implementing clients can call request interceptors inside this hook. + */ + onRequest?: (url: string, init: RequestInit) => Promise; + /** + * Callback invoked when a network or parsing error occurs during streaming. + * + * This option applies only if the endpoint returns a stream of events. + * + * @param error The error that occurred. + */ + onSseError?: (error: unknown) => void; + /** + * Callback invoked when an event is streamed from the server. + * + * This option applies only if the endpoint returns a stream of events. + * + * @param event Event streamed from the server. + * @returns Nothing (void). + */ + onSseEvent?: (event: StreamEvent) => void; + serializedBody?: RequestInit['body']; + /** + * Default retry delay in milliseconds. + * + * This option applies only if the endpoint returns a stream of events. + * + * @default 3000 + */ + sseDefaultRetryDelay?: number; + /** + * Maximum number of retry attempts before giving up. + */ + sseMaxRetryAttempts?: number; + /** + * Maximum retry delay in milliseconds. + * + * Applies only when exponential backoff is used. + * + * This option applies only if the endpoint returns a stream of events. + * + * @default 30000 + */ + sseMaxRetryDelay?: number; + /** + * Optional sleep function for retry backoff. + * + * Defaults to using `setTimeout`. + */ + sseSleepFn?: (ms: number) => Promise; + url: string; + }; + +export interface StreamEvent { + data: TData; + event?: string; + id?: string; + retry?: number; +} + +export type ServerSentEventsResult = { + stream: AsyncGenerator< + TData extends Record ? TData[keyof TData] : TData, + TReturn, + TNext + >; +}; + +export const createSseClient = ({ + onRequest, + onSseError, + onSseEvent, + responseTransformer, + responseValidator, + sseDefaultRetryDelay, + sseMaxRetryAttempts, + sseMaxRetryDelay, + sseSleepFn, + url, + ...options +}: ServerSentEventsOptions): ServerSentEventsResult => { + let lastEventId: string | undefined; + + const sleep = sseSleepFn ?? ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms))); + + const createStream = async function* () { + let retryDelay: number = sseDefaultRetryDelay ?? 3000; + let attempt = 0; + const signal = options.signal ?? new AbortController().signal; + + while (true) { + if (signal.aborted) break; + + attempt++; + + const headers = + options.headers instanceof Headers + ? options.headers + : new Headers(options.headers as Record | undefined); + + if (lastEventId !== undefined) { + headers.set('Last-Event-ID', lastEventId); + } + + try { + const requestInit: RequestInit = { + redirect: 'follow', + ...options, + body: options.serializedBody, + headers, + signal, + }; + let request = new Request(url, requestInit); + if (onRequest) { + request = await onRequest(url, requestInit); + } + // fetch must be assigned here, otherwise it would throw the error: + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation + const _fetch = options.fetch ?? globalThis.fetch; + const response = await _fetch(request); + + if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`); + + if (!response.body) throw new Error('No body in SSE response'); + + const reader = response.body.pipeThrough(new TextDecoderStream()).getReader(); + + let buffer = ''; + + const abortHandler = () => { + try { + reader.cancel(); + } catch { + // noop + } + }; + + signal.addEventListener('abort', abortHandler); + + try { + while (true) { + const { done, value } = await reader.read(); + if (done) break; + buffer += value; + // Normalize line endings: CRLF -> LF, then CR -> LF + buffer = buffer.replace(/\r\n/g, '\n').replace(/\r/g, '\n'); + + const chunks = buffer.split('\n\n'); + buffer = chunks.pop() ?? ''; + + for (const chunk of chunks) { + const lines = chunk.split('\n'); + const dataLines: Array = []; + let eventName: string | undefined; + + for (const line of lines) { + if (line.startsWith('data:')) { + dataLines.push(line.replace(/^data:\s*/, '')); + } else if (line.startsWith('event:')) { + eventName = line.replace(/^event:\s*/, ''); + } else if (line.startsWith('id:')) { + lastEventId = line.replace(/^id:\s*/, ''); + } else if (line.startsWith('retry:')) { + const parsed = Number.parseInt(line.replace(/^retry:\s*/, ''), 10); + if (!Number.isNaN(parsed)) { + retryDelay = parsed; + } + } + } + + let data: unknown; + let parsedJson = false; + + if (dataLines.length) { + const rawData = dataLines.join('\n'); + try { + data = JSON.parse(rawData); + parsedJson = true; + } catch { + data = rawData; + } + } + + if (parsedJson) { + if (responseValidator) { + await responseValidator(data); + } + + if (responseTransformer) { + data = await responseTransformer(data); + } + } + + onSseEvent?.({ + data, + event: eventName, + id: lastEventId, + retry: retryDelay, + }); + + if (dataLines.length) { + yield data as any; + } + } + } + } finally { + signal.removeEventListener('abort', abortHandler); + reader.releaseLock(); + } + + break; // exit loop on normal completion + } catch (error) { + // connection failed or aborted; retry after delay + onSseError?.(error); + + if (sseMaxRetryAttempts !== undefined && attempt >= sseMaxRetryAttempts) { + break; // stop after firing error + } + + // exponential backoff: double retry each attempt, cap at 30s + const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 30000); + await sleep(backoff); + } + } + }; + + const stream = createStream(); + + return { stream }; +}; diff --git a/vtex/server/generated/b2b-addresses/core/types.gen.ts b/vtex/server/generated/b2b-addresses/core/types.gen.ts new file mode 100644 index 00000000..97463257 --- /dev/null +++ b/vtex/server/generated/b2b-addresses/core/types.gen.ts @@ -0,0 +1,104 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Auth, AuthToken } from './auth.gen'; +import type { BodySerializer, QuerySerializer, QuerySerializerOptions } from './bodySerializer.gen'; + +export type HttpMethod = + | 'connect' + | 'delete' + | 'get' + | 'head' + | 'options' + | 'patch' + | 'post' + | 'put' + | 'trace'; + +export type Client< + RequestFn = never, + Config = unknown, + MethodFn = never, + BuildUrlFn = never, + SseFn = never, +> = { + /** + * Returns the final request URL. + */ + buildUrl: BuildUrlFn; + getConfig: () => Config; + request: RequestFn; + setConfig: (config: Config) => Config; +} & { + [K in HttpMethod]: MethodFn; +} & ([SseFn] extends [never] ? { sse?: never } : { sse: { [K in HttpMethod]: SseFn } }); + +export interface Config { + /** + * Auth token or a function returning auth token. The resolved value will be + * added to the request payload as defined by its `security` array. + */ + auth?: ((auth: Auth) => Promise | AuthToken) | AuthToken; + /** + * A function for serializing request body parameter. By default, + * {@link JSON.stringify()} will be used. + */ + bodySerializer?: BodySerializer | null; + /** + * An object containing any HTTP headers that you want to pre-populate your + * `Headers` object with. + * + * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more} + */ + headers?: + | RequestInit['headers'] + | Record< + string, + string | number | boolean | (string | number | boolean)[] | null | undefined | unknown + >; + /** + * The request method. + * + * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more} + */ + method?: Uppercase; + /** + * A function for serializing request query parameters. By default, arrays + * will be exploded in form style, objects will be exploded in deepObject + * style, and reserved characters are percent-encoded. + * + * This method will have no effect if the native `paramsSerializer()` Axios + * API function is used. + * + * {@link https://swagger.io/docs/specification/serialization/#query View examples} + */ + querySerializer?: QuerySerializer | QuerySerializerOptions; + /** + * A function validating request data. This is useful if you want to ensure + * the request conforms to the desired shape, so it can be safely sent to + * the server. + */ + requestValidator?: (data: unknown) => Promise; + /** + * A function transforming response data before it's returned. This is useful + * for post-processing data, e.g. converting ISO strings into Date objects. + */ + responseTransformer?: (data: unknown) => Promise; + /** + * A function validating response data. This is useful if you want to ensure + * the response conforms to the desired shape, so it can be safely passed to + * the transformers and returned to the user. + */ + responseValidator?: (data: unknown) => Promise; +} + +type IsExactlyNeverOrNeverUndefined = [T] extends [never] + ? true + : [T] extends [never | undefined] + ? [undefined] extends [T] + ? false + : true + : false; + +export type OmitNever> = { + [K in keyof T as IsExactlyNeverOrNeverUndefined extends true ? never : K]: T[K]; +}; diff --git a/vtex/server/generated/b2b-addresses/core/utils.gen.ts b/vtex/server/generated/b2b-addresses/core/utils.gen.ts new file mode 100644 index 00000000..e7ddbe35 --- /dev/null +++ b/vtex/server/generated/b2b-addresses/core/utils.gen.ts @@ -0,0 +1,140 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; +import { + type ArraySeparatorStyle, + serializeArrayParam, + serializeObjectParam, + serializePrimitiveParam, +} from './pathSerializer.gen'; + +export interface PathSerializer { + path: Record; + url: string; +} + +export const PATH_PARAM_RE = /\{[^{}]+\}/g; + +export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { + let url = _url; + const matches = _url.match(PATH_PARAM_RE); + if (matches) { + for (const match of matches) { + let explode = false; + let name = match.substring(1, match.length - 1); + let style: ArraySeparatorStyle = 'simple'; + + if (name.endsWith('*')) { + explode = true; + name = name.substring(0, name.length - 1); + } + + if (name.startsWith('.')) { + name = name.substring(1); + style = 'label'; + } else if (name.startsWith(';')) { + name = name.substring(1); + style = 'matrix'; + } + + const value = path[name]; + + if (value === undefined || value === null) { + continue; + } + + if (Array.isArray(value)) { + url = url.replace(match, serializeArrayParam({ explode, name, style, value })); + continue; + } + + if (typeof value === 'object') { + url = url.replace( + match, + serializeObjectParam({ + explode, + name, + style, + value: value as Record, + valueOnly: true, + }), + ); + continue; + } + + if (style === 'matrix') { + url = url.replace( + match, + `;${serializePrimitiveParam({ + name, + value: value as string, + })}`, + ); + continue; + } + + const replaceValue = encodeURIComponent( + style === 'label' ? `.${value as string}` : (value as string), + ); + url = url.replace(match, replaceValue); + } + } + return url; +}; + +export const getUrl = ({ + baseUrl, + path, + query, + querySerializer, + url: _url, +}: { + baseUrl?: string; + path?: Record; + query?: Record; + querySerializer: QuerySerializer; + url: string; +}) => { + const pathUrl = _url.startsWith('/') ? _url : `/${_url}`; + let url = (baseUrl ?? '') + pathUrl; + if (path) { + url = defaultPathSerializer({ path, url }); + } + let search = query ? querySerializer(query) : ''; + if (search.startsWith('?')) { + search = search.substring(1); + } + if (search) { + url += `?${search}`; + } + return url; +}; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // not all clients implement a serializedBody property (i.e. client-axios) + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/vtex/server/generated/b2b-addresses/index.ts b/vtex/server/generated/b2b-addresses/index.ts new file mode 100644 index 00000000..0576ed3a --- /dev/null +++ b/vtex/server/generated/b2b-addresses/index.ts @@ -0,0 +1,4 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export { deleteApiDataentitiesAdDocumentsByAddressId, deleteApiDataentitiesContactInformationDocumentsByRecipientId, deleteApiDataentitiesCustomFieldValuesDocumentsByLocationId, getApiDataentitiesAdDocumentsByAddressId, getApiDataentitiesAdSearch, getApiDataentitiesContactInformationDocumentsByRecipientId, getApiDataentitiesContactInformationSearch, getApiDataentitiesCustomFieldValuesDocumentsByLocationId, getApiDataentitiesCustomFieldValuesSearch, type Options, patchApiDataentitiesAdDocumentsByAddressId, patchApiDataentitiesContactInformationDocumentsByRecipientId, patchApiDataentitiesCustomFieldValuesDocumentsByLocationId, postApiDataentitiesAdDocuments, postApiDataentitiesContactInformationDocuments, postApiDataentitiesCustomFieldValuesDocuments } from './sdk.gen'; +export type { Accept, AddressResponse, ClientOptions, ContentType, CreateUpdateAddressRequests, DeleteApiDataentitiesAdDocumentsByAddressIdData, DeleteApiDataentitiesAdDocumentsByAddressIdResponse, DeleteApiDataentitiesAdDocumentsByAddressIdResponses, DeleteApiDataentitiesContactInformationDocumentsByRecipientIdData, DeleteApiDataentitiesContactInformationDocumentsByRecipientIdResponse, DeleteApiDataentitiesContactInformationDocumentsByRecipientIdResponses, DeleteApiDataentitiesCustomFieldValuesDocumentsByLocationIdData, DeleteApiDataentitiesCustomFieldValuesDocumentsByLocationIdResponse, DeleteApiDataentitiesCustomFieldValuesDocumentsByLocationIdResponses, DocumentResponse, Fields, GetApiDataentitiesAdDocumentsByAddressIdData, GetApiDataentitiesAdDocumentsByAddressIdResponse, GetApiDataentitiesAdDocumentsByAddressIdResponses, GetApiDataentitiesAdSearchData, GetApiDataentitiesAdSearchErrors, GetApiDataentitiesAdSearchResponse, GetApiDataentitiesAdSearchResponses, GetApiDataentitiesContactInformationDocumentsByRecipientIdData, GetApiDataentitiesContactInformationDocumentsByRecipientIdResponse, GetApiDataentitiesContactInformationDocumentsByRecipientIdResponses, GetApiDataentitiesContactInformationSearchData, GetApiDataentitiesContactInformationSearchResponse, GetApiDataentitiesContactInformationSearchResponses, GetApiDataentitiesCustomFieldValuesDocumentsByLocationIdData, GetApiDataentitiesCustomFieldValuesDocumentsByLocationIdResponse, GetApiDataentitiesCustomFieldValuesDocumentsByLocationIdResponses, GetApiDataentitiesCustomFieldValuesSearchData, GetApiDataentitiesCustomFieldValuesSearchResponse, GetApiDataentitiesCustomFieldValuesSearchResponses, LocationId, LocationRequest, PatchApiDataentitiesAdDocumentsByAddressIdData, PatchApiDataentitiesAdDocumentsByAddressIdResponse, PatchApiDataentitiesAdDocumentsByAddressIdResponses, PatchApiDataentitiesContactInformationDocumentsByRecipientIdData, PatchApiDataentitiesContactInformationDocumentsByRecipientIdResponse, PatchApiDataentitiesContactInformationDocumentsByRecipientIdResponses, PatchApiDataentitiesCustomFieldValuesDocumentsByLocationIdData, PatchApiDataentitiesCustomFieldValuesDocumentsByLocationIdResponse, PatchApiDataentitiesCustomFieldValuesDocumentsByLocationIdResponses, PostApiDataentitiesAdDocumentsData, PostApiDataentitiesAdDocumentsResponse, PostApiDataentitiesAdDocumentsResponses, PostApiDataentitiesContactInformationDocumentsData, PostApiDataentitiesContactInformationDocumentsResponse, PostApiDataentitiesContactInformationDocumentsResponses, PostApiDataentitiesCustomFieldValuesDocumentsData, PostApiDataentitiesCustomFieldValuesDocumentsResponse, PostApiDataentitiesCustomFieldValuesDocumentsResponses, RecipientRequest } from './types.gen'; diff --git a/vtex/server/generated/b2b-addresses/sdk.gen.ts b/vtex/server/generated/b2b-addresses/sdk.gen.ts new file mode 100644 index 00000000..79d2c7ab --- /dev/null +++ b/vtex/server/generated/b2b-addresses/sdk.gen.ts @@ -0,0 +1,518 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Client, Options as Options2, TDataShape } from './client'; +import { client } from './client.gen'; +import type { DeleteApiDataentitiesAdDocumentsByAddressIdData, DeleteApiDataentitiesAdDocumentsByAddressIdResponses, DeleteApiDataentitiesContactInformationDocumentsByRecipientIdData, DeleteApiDataentitiesContactInformationDocumentsByRecipientIdResponses, DeleteApiDataentitiesCustomFieldValuesDocumentsByLocationIdData, DeleteApiDataentitiesCustomFieldValuesDocumentsByLocationIdResponses, GetApiDataentitiesAdDocumentsByAddressIdData, GetApiDataentitiesAdDocumentsByAddressIdResponses, GetApiDataentitiesAdSearchData, GetApiDataentitiesAdSearchErrors, GetApiDataentitiesAdSearchResponses, GetApiDataentitiesContactInformationDocumentsByRecipientIdData, GetApiDataentitiesContactInformationDocumentsByRecipientIdResponses, GetApiDataentitiesContactInformationSearchData, GetApiDataentitiesContactInformationSearchResponses, GetApiDataentitiesCustomFieldValuesDocumentsByLocationIdData, GetApiDataentitiesCustomFieldValuesDocumentsByLocationIdResponses, GetApiDataentitiesCustomFieldValuesSearchData, GetApiDataentitiesCustomFieldValuesSearchResponses, PatchApiDataentitiesAdDocumentsByAddressIdData, PatchApiDataentitiesAdDocumentsByAddressIdResponses, PatchApiDataentitiesContactInformationDocumentsByRecipientIdData, PatchApiDataentitiesContactInformationDocumentsByRecipientIdResponses, PatchApiDataentitiesCustomFieldValuesDocumentsByLocationIdData, PatchApiDataentitiesCustomFieldValuesDocumentsByLocationIdResponses, PostApiDataentitiesAdDocumentsData, PostApiDataentitiesAdDocumentsResponses, PostApiDataentitiesContactInformationDocumentsData, PostApiDataentitiesContactInformationDocumentsResponses, PostApiDataentitiesCustomFieldValuesDocumentsData, PostApiDataentitiesCustomFieldValuesDocumentsResponses } from './types.gen'; + +export type Options = Options2 & { + /** + * You can provide a client instance returned by `createClient()` instead of + * individual options. This might be also useful if you want to implement a + * custom client. + */ + client?: Client; + /** + * You can pass arbitrary values through the `meta` object. This can be + * used to access values that aren't defined as part of the SDK function. + */ + meta?: Record; +}; + +/** + * Create B2B address + * + * Creates a new B2B address document in the `AD` data entity. + * + * >⚠️ This feature is only available for stores using B2B Buyer Portal, which is currently available to select accounts. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Dynamic Storage | Dynamic storage generic resources | **Insert or update document (not remove)** | + * | Dynamic Storage | Dynamic storage generic resources | **Full access to all documents** | + * | Dynamic Storage | Dynamic storage generic resources | **Master Data administrator** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const postApiDataentitiesAdDocuments = (options: Options) => (options.client ?? client).post({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/dataentities/AD/documents', + ...options +}); + +/** + * Search B2B addresses + * + * Retrieves B2B addresses from the `AD` data entity, with support for field selection, filtering, sorting, and pagination. + * + * >⚠️ This feature is only available for stores using B2B Buyer Portal, which is currently available to select accounts. + * + * >ℹ️ Learn more about [Pagination in the Master Data API](https://developers.vtex.com/docs/guides/pagination-in-the-master-data-api) and [Querying documents in Master Data v1](https://developers.vtex.com/docs/guides/querying-documents-in-master-data-v1). + * + * ## Query examples + * + * | **Filter type** | **Example** | + * | --- | --- | + * | **Simple filter** | `/dataentities/AD/search?userId=2da4e9ab-050b-11f0-b37f-f4b136dbcce1` | + * | **Complex filter** | `/dataentities/AD/search?_where=(addressType=commercial OR addressType=invoice) AND country=USA` | + * | **Date range** | `/dataentities/AD/search?_where=createdIn between 2024-01-01 AND 2025-01-01` | + * | **Partial filter** | `/dataentities/AD/search?city=*Orlando*` | + * | **Null values** | `/dataentities/AD/search?_where=reference is null` | + * | **Non-null values** | `/dataentities/AD/search?_where=reference is not null` | + * | **Difference** | `/dataentities/AD/search?_where=state<>FL` | + * + * >⚠️ Avoid sending too many requests with wildcards (`*`) in the search parameters or that use the `keyword` parameter. This may lead to this endpoint being temporarily blocked for your account. If this happens you will receive an error with status code `503`. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Dynamic Storage | Dynamic storage generic resources | **Read only documents** | + * | Dynamic Storage | Dynamic storage generic resources | **Insert or update document (not remove)** | + * | Dynamic Storage | Dynamic storage generic resources | **Full access to all documents** | + * | Dynamic Storage | Dynamic storage generic resources | **Master Data administrator** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const getApiDataentitiesAdSearch = (options: Options) => (options.client ?? client).get({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/dataentities/AD/search', + ...options +}); + +/** + * Delete B2B address + * + * Deletes a specific B2B address document from the `AD` data entity. + * + * >⚠️ This feature is only available for stores using B2B Buyer Portal, which is currently available to select accounts. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Dynamic Storage | Dynamic storage generic resources | **Full access to all documents** | + * | Dynamic Storage | Dynamic storage generic resources | **Master Data administrator** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const deleteApiDataentitiesAdDocumentsByAddressId = (options: Options) => (options.client ?? client).delete({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/dataentities/AD/documents/{addressId}', + ...options +}); + +/** + * Get B2B address by ID + * + * Retrieves information of a specific B2B address by its unique identifier. + * + * >⚠️ This feature is only available for stores using B2B Buyer Portal, which is currently available to select accounts. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Dynamic Storage | Dynamic storage generic resources | **Read only documents** | + * | Dynamic Storage | Dynamic storage generic resources | **Insert or update document (not remove)** | + * | Dynamic Storage | Dynamic storage generic resources | **Full access to all documents** | + * | Dynamic Storage | Dynamic storage generic resources | **Master Data administrator** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const getApiDataentitiesAdDocumentsByAddressId = (options: Options) => (options.client ?? client).get({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/dataentities/AD/documents/{addressId}', + ...options +}); + +/** + * Update B2B address + * + * Partially updates an existing B2B address document in the `AD` data entity. + * + * > ⚠️ When updating addresses you must send each field according to the specifications provided. Otherwise, the Checkout module will not be able to autofill data during the shopping flow, which can block the purchase. Learn more about [SmartCheckout - Customer information automatic fill-in](https://help.vtex.com/en/tutorial/smartcheckout-preenchimento-automatico-de-dados-do-cliente--2Nuu3xAFzdhIzJIldAdtan). + * + * >⚠️ This feature is only available for stores using B2B Buyer Portal, which is currently available to select accounts. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Dynamic Storage | Dynamic storage generic resources | **Insert or update document (not remove)** | + * | Dynamic Storage | Dynamic storage generic resources | **Full access to all documents** | + * | Dynamic Storage | Dynamic storage generic resources | **Master Data administrator** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const patchApiDataentitiesAdDocumentsByAddressId = (options: Options) => (options.client ?? client).patch({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/dataentities/AD/documents/{addressId}', + ...options +}); + +/** + * Create recipient + * + * Creates a new recipient document in the `contact_information` data entity. A recipient represents a person who can receive orders at one or more B2B addresses. Use the `addressIds` field to associate the recipient with existing B2B addresses from the `AD` data entity. + * + * >⚠️ This feature is only available for stores using B2B Buyer Portal, which is currently available to select accounts. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Dynamic Storage | Dynamic storage generic resources | **Insert or update document (not remove)** | + * | Dynamic Storage | Dynamic storage generic resources | **Full access to all documents** | + * | Dynamic Storage | Dynamic storage generic resources | **Master Data administrator** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const postApiDataentitiesContactInformationDocuments = (options: Options) => (options.client ?? client).post({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/dataentities/contact_information/documents', + ...options +}); + +/** + * Search recipients + * + * Searches for recipients in the `contact_information` data entity based on the query parameters. Recipients returned by this endpoint can be linked to one or more B2B addresses through the `addressIds` field. + * + * >⚠️ The `_schema` query parameter is required and must be set to `v1`. + * + * > ℹ️ It is also possible to use pagination and sort as described in the [Master Data v2 Search API](https://developers.vtex.com/docs/api-reference/master-data-api-v2#get-/api/dataentities/-dataEntityName-/search) documentation. + * + * >⚠️ This feature is only available for stores using B2B Buyer Portal, which is currently available to select accounts. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Dynamic Storage | Dynamic storage generic resources | **Read only documents** | + * | Dynamic Storage | Dynamic storage generic resources | **Insert or update document (not remove)** | + * | Dynamic Storage | Dynamic storage generic resources | **Full access to all documents** | + * | Dynamic Storage | Dynamic storage generic resources | **Master Data administrator** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const getApiDataentitiesContactInformationSearch = (options: Options) => (options.client ?? client).get({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/dataentities/contact_information/search', + ...options +}); + +/** + * Delete recipient + * + * Deletes a recipient document from the `contact_information` data entity. This operation does not delete the B2B addresses associated with the recipient through the `addressIds` field. + * + * >⚠️ This feature is only available for stores using B2B Buyer Portal, which is currently available to select accounts. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Dynamic Storage | Dynamic storage generic resources | **Full access to all documents** | + * | Dynamic Storage | Dynamic storage generic resources | **Master Data administrator** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const deleteApiDataentitiesContactInformationDocumentsByRecipientId = (options: Options) => (options.client ?? client).delete({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/dataentities/contact_information/documents/{recipientId}', + ...options +}); + +/** + * Get recipient by ID + * + * Retrieves a recipient by ID from the `contact_information` data entity. The returned recipient may be associated with one or more B2B addresses through the `addressIds` field. + * + * >ℹ️ Assign the `_fields` parameter in the query string to retrieve the desired fields. If you want to return all the fields use `_fields=_all`. + * + * >⚠️ The `_schema` query parameter is required and must be set to `v1`. + * + * >⚠️ This feature is only available for stores using B2B Buyer Portal, which is currently available to select accounts. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Dynamic Storage | Dynamic storage generic resources | **Read only documents** | + * | Dynamic Storage | Dynamic storage generic resources | **Insert or update document (not remove)** | + * | Dynamic Storage | Dynamic storage generic resources | **Full access to all documents** | + * | Dynamic Storage | Dynamic storage generic resources | **Master Data administrator** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const getApiDataentitiesContactInformationDocumentsByRecipientId = (options: Options) => (options.client ?? client).get({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/dataentities/contact_information/documents/{recipientId}', + ...options +}); + +/** + * Update recipient + * + * Partially updates a recipient document in the `contact_information` data entity. Use the `addressIds` field to change the B2B addresses associated with the recipient. + * + * >⚠️ This feature is only available for stores using B2B Buyer Portal, which is currently available to select accounts. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Dynamic Storage | Dynamic storage generic resources | **Insert or update document (not remove)** | + * | Dynamic Storage | Dynamic storage generic resources | **Full access to all documents** | + * | Dynamic Storage | Dynamic storage generic resources | **Master Data administrator** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const patchApiDataentitiesContactInformationDocumentsByRecipientId = (options: Options) => (options.client ?? client).patch({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/dataentities/contact_information/documents/{recipientId}', + ...options +}); + +/** + * Create location + * + * Creates a location value associated with a B2B address. A location is a [custom checkout field](https://developers.vtex.com/docs/guides/custom-fields-integration) value linked to a specific B2B address through the `auxId` field (the B2B address ID). This endpoint assumes the underlying location setting is already configured, which is the native behavior. + * + * >⚠️ This feature is only available for stores using B2B Buyer Portal, which is currently available to select accounts. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Dynamic Storage | Dynamic storage generic resources | **Insert or update document (not remove)** | + * | Dynamic Storage | Dynamic storage generic resources | **Full access to all documents** | + * | Dynamic Storage | Dynamic storage generic resources | **Master Data administrator** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const postApiDataentitiesCustomFieldValuesDocuments = (options: Options) => (options.client ?? client).post({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/dataentities/customFieldValues/documents', + ...options +}); + +/** + * Delete location + * + * Deletes a specific location. + * + * >⚠️ This feature is only available for stores using B2B Buyer Portal, which is currently available to select accounts. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Dynamic Storage | Dynamic storage generic resources | **Full access to all documents** | + * | Dynamic Storage | Dynamic storage generic resources | **Master Data administrator** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const deleteApiDataentitiesCustomFieldValuesDocumentsByLocationId = (options: Options) => (options.client ?? client).delete({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/dataentities/customFieldValues/documents/{locationId}', + ...options +}); + +/** + * Get location + * + * Retrieves a specific location by its ID. The `auxId` field identifies the B2B address associated with this location. + * + * >⚠️ This feature is only available for stores using B2B Buyer Portal, which is currently available to select accounts. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Dynamic Storage | Dynamic storage generic resources | **Read only documents** | + * | Dynamic Storage | Dynamic storage generic resources | **Insert or update document (not remove)** | + * | Dynamic Storage | Dynamic storage generic resources | **Full access to all documents** | + * | Dynamic Storage | Dynamic storage generic resources | **Master Data administrator** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const getApiDataentitiesCustomFieldValuesDocumentsByLocationId = (options: Options) => (options.client ?? client).get({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/dataentities/customFieldValues/documents/{locationId}', + ...options +}); + +/** + * Update location + * + * Updates a specific location. The `auxId` field must match the B2B address ID to which the location belongs. + * + * >⚠️ This feature is only available for stores using B2B Buyer Portal, which is currently available to select accounts. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Dynamic Storage | Dynamic storage generic resources | **Insert or update document (not remove)** | + * | Dynamic Storage | Dynamic storage generic resources | **Full access to all documents** | + * | Dynamic Storage | Dynamic storage generic resources | **Master Data administrator** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const patchApiDataentitiesCustomFieldValuesDocumentsByLocationId = (options: Options) => (options.client ?? client).patch({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/dataentities/customFieldValues/documents/{locationId}', + ...options +}); + +/** + * Search locations + * + * Retrieves locations filtered by contract ID, location setting ID, and optionally by specific value. When searching locations associated with a particular B2B address, filter by `auxId={{addressId}}`. Results can be sorted by value. + * + * You can use the `_where` query parameter to filter results: + * - To get all locations for a contract and setting: `_where=contractId={{contractId}} AND customFieldId="{{customFieldId}}"` + * - To get locations for a specific B2B address: `_where=contractId={{contractId}} AND customFieldId="{{customFieldId}}" AND auxId="{{addressId}}"` + * - To get a specific value: `_where=contractId={{contractId}} AND customFieldId="{{customFieldId}}" AND value="{{value}}"` + * + * >⚠️ This feature is only available for stores using B2B Buyer Portal, which is currently available to select accounts. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Dynamic Storage | Dynamic storage generic resources | **Read only documents** | + * | Dynamic Storage | Dynamic storage generic resources | **Insert or update document (not remove)** | + * | Dynamic Storage | Dynamic storage generic resources | **Full access to all documents** | + * | Dynamic Storage | Dynamic storage generic resources | **Master Data administrator** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const getApiDataentitiesCustomFieldValuesSearch = (options: Options) => (options.client ?? client).get({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/dataentities/customFieldValues/search', + ...options +}); diff --git a/vtex/server/generated/b2b-addresses/types.gen.ts b/vtex/server/generated/b2b-addresses/types.gen.ts new file mode 100644 index 00000000..dd356688 --- /dev/null +++ b/vtex/server/generated/b2b-addresses/types.gen.ts @@ -0,0 +1,937 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type ClientOptions = { + baseUrl: 'https://{accountName}.{environment}.com.br' | (string & {}); +}; + +/** + * Request body object for creating or updating a B2B address. + */ +export type CreateUpdateAddressRequests = { + /** + * Address name. + */ + addressName?: string | null; + /** + * Custom label for the address used by shoppers and buyer organization managers. + */ + addressLabel?: string | null; + /** + * Type of address. Use `commercial` for shipping (delivery) addresses and `invoice` for billing (payment) addresses. + */ + addressType: 'commercial' | 'invoice'; + /** + * Name of the person who is going to receive orders at this address. This field will be deprecated in favor of the [Recipients](https://developers.vtex.com/docs/api-reference/b2b-addresses#post-/api/dataentities/contact_information/documents) feature, but it must be filled with some value (for example, `.`). + */ + receiverName: string; + /** + * City of the B2B address. + */ + city: string; + /** + * State or province of the B2B address. Must be a two-letter code (for example, `FL` or `SP`). Full names such as `Florida` are not accepted. + */ + state: string; + /** + * Three-letter [ISO 3166-1 alpha-3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) country code of the B2B address (for example, `BRA` or `USA`). + */ + country: string; + /** + * Postal code of the B2B address. Must be a string following the exact country format (for example, `02999` instead of `2999`). Nine-digit formats are not accepted. + */ + postalCode: string; + /** + * Street name of the B2B address. + */ + street: string; + /** + * Number of the building, house, or apartment in the B2B address. + */ + number: string; + /** + * Neighborhood of the B2B address. + */ + neighborhood?: string | null; + /** + * Additional information or details that help identify or locate the B2B address, such as apartment number, suite, floor, or unit (if applicable). + */ + complement?: string | null; + /** + * Optional reference point or nearby landmark to help locate the B2B address during delivery (for example, next to a park or behind a building). + */ + reference?: string | null; + /** + * Geographical coordinates of the B2B address. Optional. Must be an array of doubles representing latitude and longitude (for example, `[28.48, -81.20]`), or an empty array `[]`. + */ + geoCoordinates?: Array | null; + /** + * ID of the buyer organization to whom the B2B address belongs. This information is the `id` returned by the customer profile (or contract) creation request. + */ + userId: string; +}; + +/** + * Response body object for a created or updated document. + */ +export type DocumentResponse = { + /** + * ID of the document that was created or updated. + */ + Id: string; + /** + * Document reference URL. + */ + Href: string; +}; + +/** + * Response body for a B2B address document. + */ +export type AddressResponse = { + /** + * User-defined label to identify the B2B address. + */ + addressLabel?: string | null; + /** + * Type of B2B address. `commercial` for shipping (delivery) or `invoice` for billing (payment). + */ + addressType?: 'commercial' | 'invoice'; + /** + * City of the B2B address. + */ + city?: string | null; + /** + * Any additional information for the B2B address (for example, apartment or floor). + */ + complement?: string | null; + /** + * Country of the B2B address in three-letter [ISO 3166-1 alpha-3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) format (for example, `USA`). + */ + country?: string | null; + /** + * Geographical coordinates of the B2B address as an array of doubles (latitude and longitude), or an empty array `[]`. + */ + geoCoordinates?: Array | null; + /** + * Neighborhood of the B2B address. + */ + neighborhood?: string | null; + /** + * Street number of the B2B address. + */ + number?: string | null; + /** + * Postal code of the B2B address. The format must match the exact country postal code format (for example, `02999` for addresses in the USA). + */ + postalCode?: string | null; + /** + * Name of the person or entity receiving at this B2B address. This field will be deprecated in favor of the [Recipients](https://developers.vtex.com/docs/api-reference/b2b-addresses#post-/api/dataentities/contact_information/documents) feature, but it must be filled with some value. + */ + receiverName?: string | null; + /** + * Optional reference point or landmark near the B2B address. + */ + reference?: string | null; + /** + * State or province of the B2B address as a two-letter code (for example, `FL` or `SP`). + */ + state?: string | null; + /** + * Street name of the B2B address. + */ + street?: string | null; + /** + * ID of the buyer organization to whom the B2B address belongs. + */ + userId?: string | null; + /** + * Unique identifier for this B2B address record. + */ + id?: string | null; + /** + * ID of the account related to this B2B address. + */ + accountId?: string | null; + /** + * Name of the account related to this B2B address. + */ + accountName?: string | null; + /** + * ID of the data entity this B2B address belongs to (always `AD`). + */ + dataEntityId?: string | null; + /** + * ID of the user who created the B2B address record. + */ + createdBy?: string | null; + /** + * Timestamp of when the B2B address record was created. + */ + createdIn?: string | null; + /** + * ID of the user who last updated the B2B address record. + */ + updatedBy?: string | null; + /** + * Timestamp of the last update to the B2B address record. + */ + updatedIn?: string | null; + /** + * ID of the user who had the last interaction with the record. + */ + lastInteractionBy?: string | null; + /** + * Timestamp of the last interaction with the record. + */ + lastInteractionIn?: string | null; + /** + * List of users following this B2B address record. + */ + followers?: Array | null; + /** + * List of tags associated with this B2B address. + */ + tags?: Array | null; +}; + +/** + * Recipient document object. A recipient can be associated with one or more B2B addresses through the `addressIds` field. + */ +export type RecipientRequest = { + /** + * Recipient email. + */ + email?: string; + /** + * Recipient first name. + */ + firstName: string; + /** + * Recipient last name. + */ + lastName: string; + /** + * ID of the contract (`CL` data entity) that owns the recipient. This is the `id` returned by the contract creation request. + */ + profileId?: string; + /** + * Main phone number. + */ + phone?: string; + /** + * Internal phone extension, if applicable. + */ + phoneExtension?: string; + /** + * Identification document. + */ + document?: string; + /** + * Type of document. + */ + documentType?: string; + /** + * References to the B2B addresses associated with the recipient. Each value is the UUID of an address stored in the `AD` data entity. + */ + addressIds?: Array; +}; + +/** + * Location object. A location is a value of a [custom checkout field](https://developers.vtex.com/docs/guides/custom-fields-integration) associated with a B2B address through the `auxId` field. + */ +export type LocationRequest = { + /** + * The ID of the contract to which the location belongs. + */ + contractId: string; + /** + * The ID of the location setting (native configuration) that this location is a value of. To discover the `customFieldId` for your account, list the existing settings with `GET` [Search custom field settings](https://developers.vtex.com/docs/api-reference/custom-fields-api#get-/api/dataentities/customFieldSettings/search) and pick the one matching the location feature. + */ + customFieldId: string; + /** + * ID of the B2B address associated with this location. + */ + auxId: string; + /** + * The value to be stored for the location (max length 22 characters). + */ + value: string; + /** + * Details what the value represents. + */ + description?: string; +}; + +/** + * Type of the content being sent. + */ +export type ContentType = string; + +/** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ +export type Accept = string; + +/** + * Comma-separated list of field names to be returned in the response. This query string parameter allows you to specify which fields to include. Use `_all` to return all fields, or specify individual fields like `id,contractId,value`. Learn more about [searching documents in Master Data v2](https://developers.vtex.com/docs/guides/search-documents-in-master-data). + */ +export type Fields = string; + +/** + * Unique identifier of the location document. + */ +export type LocationId = string; + +export type PostApiDataentitiesAdDocumentsData = { + body?: CreateUpdateAddressRequests; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path?: never; + query?: never; + url: '/api/dataentities/AD/documents'; +}; + +export type PostApiDataentitiesAdDocumentsResponses = { + /** + * OK + */ + 200: DocumentResponse; +}; + +export type PostApiDataentitiesAdDocumentsResponse = PostApiDataentitiesAdDocumentsResponses[keyof PostApiDataentitiesAdDocumentsResponses]; + +export type GetApiDataentitiesAdSearchData = { + body?: never; + headers: { + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + /** + * Specifies the range of documents to be returned in the response. The value should follow the format `resources={x}-{y}`, where: + * * `x`: Index of the first document in the returned array. + * * `y`: Index of the last document in the returned array + 1. + * + * This field controls pagination by defining the subset of documents to be retrieved. The maximum number of documents returned per query is limited to 100. For example, `resources=0-10` returns the first 10 documents. + */ + 'REST-Range': string; + }; + path?: never; + query?: { + /** + * Names of the fields that will be returned per document, separated by a comma `,`. It is possible to fetch all fields using `_all` as the value of this query parameter. However, in order to avoid permission errors, we strongly recommend informing only the names of the exact fields that will be used. + */ + _fields?: string; + /** + * Defines a condition the B2B address document must comply with. When referring to fields, you can use a nested field up to the first level. For example, filter by buyer organization with `userId=2da4e9ab-050b-11f0-b37f-f4b136dbcce1`. + */ + _where?: string; + /** + * Defines sorting mode in two parts. The first part is the name of the field you want to sort by. In the second part, use `ASC` for ascending order or `DESC` for descending order. + */ + _sort?: string; + }; + url: '/api/dataentities/AD/search'; +}; + +export type GetApiDataentitiesAdSearchErrors = { + /** + * Service Unavailable + */ + 503: unknown; +}; + +export type GetApiDataentitiesAdSearchResponses = { + /** + * List of B2B address documents matching the search criteria. + */ + 200: Array; +}; + +export type GetApiDataentitiesAdSearchResponse = GetApiDataentitiesAdSearchResponses[keyof GetApiDataentitiesAdSearchResponses]; + +export type DeleteApiDataentitiesAdDocumentsByAddressIdData = { + body?: never; + headers: { + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path: { + /** + * ID of the B2B address to be deleted. + */ + addressId: string; + }; + query?: never; + url: '/api/dataentities/AD/documents/{addressId}'; +}; + +export type DeleteApiDataentitiesAdDocumentsByAddressIdResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeleteApiDataentitiesAdDocumentsByAddressIdResponse = DeleteApiDataentitiesAdDocumentsByAddressIdResponses[keyof DeleteApiDataentitiesAdDocumentsByAddressIdResponses]; + +export type GetApiDataentitiesAdDocumentsByAddressIdData = { + body?: never; + headers: { + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path: { + /** + * ID of the B2B address to retrieve. + */ + addressId: string; + }; + query?: { + /** + * Specifies which fields of the document should be included in the response. Use `_all` to return all fields, or provide a comma-separated list of field names. + */ + _fields?: string; + }; + url: '/api/dataentities/AD/documents/{addressId}'; +}; + +export type GetApiDataentitiesAdDocumentsByAddressIdResponses = { + /** + * OK + */ + 200: AddressResponse; +}; + +export type GetApiDataentitiesAdDocumentsByAddressIdResponse = GetApiDataentitiesAdDocumentsByAddressIdResponses[keyof GetApiDataentitiesAdDocumentsByAddressIdResponses]; + +export type PatchApiDataentitiesAdDocumentsByAddressIdData = { + body?: CreateUpdateAddressRequests; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path: { + /** + * ID of the B2B address to update. + */ + addressId: string; + }; + query?: never; + url: '/api/dataentities/AD/documents/{addressId}'; +}; + +export type PatchApiDataentitiesAdDocumentsByAddressIdResponses = { + /** + * OK + */ + 200: DocumentResponse; +}; + +export type PatchApiDataentitiesAdDocumentsByAddressIdResponse = PatchApiDataentitiesAdDocumentsByAddressIdResponses[keyof PatchApiDataentitiesAdDocumentsByAddressIdResponses]; + +export type PostApiDataentitiesContactInformationDocumentsData = { + body?: RecipientRequest; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path?: never; + query?: never; + url: '/api/dataentities/contact_information/documents'; +}; + +export type PostApiDataentitiesContactInformationDocumentsResponses = { + /** + * Recipient document creation response. + */ + 201: { + /** + * Recipient document identifier. The prefix corresponds to the `contact_information` data entity name. + */ + Id?: string; + /** + * Recipient document store path. + */ + Href?: string; + /** + * Recipient document ID. + */ + DocumentId?: string; + }; +}; + +export type PostApiDataentitiesContactInformationDocumentsResponse = PostApiDataentitiesContactInformationDocumentsResponses[keyof PostApiDataentitiesContactInformationDocumentsResponses]; + +export type GetApiDataentitiesContactInformationSearchData = { + body?: never; + headers: { + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path?: never; + query: { + /** + * Filter for recipient documents. This is a Master Data search condition built from the field names defined on the `contact_information` entity and the values you want to match. Use `fieldName=value` (for example, `email=example@example.com` or `profileId=878fa807-7c7b-4ad3-aaa6-e3ef4fb22b8f`). Combine conditions using the syntax supported for the Master Data v2 [Search Documents endpoint](https://developers.vtex.com/docs/api-reference/master-data-api-v2#get-/api/dataentities/-dataEntityName-/search?endpoint=get-/api/dataentities/-dataEntityName-/search) (for example, `AND` / `OR` where applicable). Which fields you can use depends on your entity schema, not on this API parameter alone. + */ + _where: string; + /** + * Fields that should be returned by document. Separate fields' names with commas. For example `_fields=firstName,lastName,email`. The default behavior is to return all fields. You can also use `_fields=_all` to fetch all fields. + */ + _fields?: string; + /** + * Master Data version. This field must be `v1`. + */ + _schema: string; + }; + url: '/api/dataentities/contact_information/search'; +}; + +export type GetApiDataentitiesContactInformationSearchResponses = { + /** + * Array of recipient objects. + */ + 200: Array<{ + /** + * Recipient first name. + */ + firstName?: string; + /** + * Recipient last name. + */ + lastName?: string; + /** + * Recipient email. + */ + email?: string; + }>; +}; + +export type GetApiDataentitiesContactInformationSearchResponse = GetApiDataentitiesContactInformationSearchResponses[keyof GetApiDataentitiesContactInformationSearchResponses]; + +export type DeleteApiDataentitiesContactInformationDocumentsByRecipientIdData = { + body?: never; + headers: { + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path: { + /** + * Unique identifier of the recipient document. + */ + recipientId: string; + }; + query?: never; + url: '/api/dataentities/contact_information/documents/{recipientId}'; +}; + +export type DeleteApiDataentitiesContactInformationDocumentsByRecipientIdResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeleteApiDataentitiesContactInformationDocumentsByRecipientIdResponse = DeleteApiDataentitiesContactInformationDocumentsByRecipientIdResponses[keyof DeleteApiDataentitiesContactInformationDocumentsByRecipientIdResponses]; + +export type GetApiDataentitiesContactInformationDocumentsByRecipientIdData = { + body?: never; + headers: { + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path: { + /** + * Unique identifier of the recipient document. + */ + recipientId: string; + }; + query: { + /** + * Fields that should be returned by document. Separate fields' names with commas. For example `_fields=email,firstName,document`. You can also use `_fields=_all` to fetch all fields. + */ + _fields?: string; + /** + * Master Data version. This field must be `v1`. + */ + _schema: string; + }; + url: '/api/dataentities/contact_information/documents/{recipientId}'; +}; + +export type GetApiDataentitiesContactInformationDocumentsByRecipientIdResponses = { + /** + * OK + */ + 200: RecipientRequest; +}; + +export type GetApiDataentitiesContactInformationDocumentsByRecipientIdResponse = GetApiDataentitiesContactInformationDocumentsByRecipientIdResponses[keyof GetApiDataentitiesContactInformationDocumentsByRecipientIdResponses]; + +export type PatchApiDataentitiesContactInformationDocumentsByRecipientIdData = { + body?: RecipientRequest; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path: { + /** + * Unique identifier of the recipient document. + */ + recipientId: string; + }; + query?: never; + url: '/api/dataentities/contact_information/documents/{recipientId}'; +}; + +export type PatchApiDataentitiesContactInformationDocumentsByRecipientIdResponses = { + /** + * No Content + */ + 204: void; +}; + +export type PatchApiDataentitiesContactInformationDocumentsByRecipientIdResponse = PatchApiDataentitiesContactInformationDocumentsByRecipientIdResponses[keyof PatchApiDataentitiesContactInformationDocumentsByRecipientIdResponses]; + +export type PostApiDataentitiesCustomFieldValuesDocumentsData = { + body?: LocationRequest; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path?: never; + query?: never; + url: '/api/dataentities/customFieldValues/documents'; +}; + +export type PostApiDataentitiesCustomFieldValuesDocumentsResponses = { + /** + * Response object containing the created location information. + */ + 200: { + /** + * Unique identifier of the created location, prefixed with the data entity name. + */ + Id?: string; + /** + * Direct URL to access the created location document. + */ + Href?: string; + /** + * The location ID without the data entity prefix. + */ + DocumentId?: string; + }; +}; + +export type PostApiDataentitiesCustomFieldValuesDocumentsResponse = PostApiDataentitiesCustomFieldValuesDocumentsResponses[keyof PostApiDataentitiesCustomFieldValuesDocumentsResponses]; + +export type DeleteApiDataentitiesCustomFieldValuesDocumentsByLocationIdData = { + body?: never; + headers: { + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path: { + /** + * Unique identifier of the location document. + */ + locationId: string; + }; + query: { + /** + * Comma-separated list of field names to be returned in the response. This query string parameter allows you to specify which fields to include. Use `_all` to return all fields, or specify individual fields like `id,contractId,value`. Learn more about [searching documents in Master Data v2](https://developers.vtex.com/docs/guides/search-documents-in-master-data). + */ + _fields: string; + }; + url: '/api/dataentities/customFieldValues/documents/{locationId}'; +}; + +export type DeleteApiDataentitiesCustomFieldValuesDocumentsByLocationIdResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeleteApiDataentitiesCustomFieldValuesDocumentsByLocationIdResponse = DeleteApiDataentitiesCustomFieldValuesDocumentsByLocationIdResponses[keyof DeleteApiDataentitiesCustomFieldValuesDocumentsByLocationIdResponses]; + +export type GetApiDataentitiesCustomFieldValuesDocumentsByLocationIdData = { + body?: never; + headers: { + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path: { + /** + * Unique identifier of the location document. + */ + locationId: string; + }; + query: { + /** + * Comma-separated list of field names to be returned in the response. This query string parameter allows you to specify which fields to include. Use `_all` to return all fields, or specify individual fields like `id,contractId,value`. Learn more about [searching documents in Master Data v2](https://developers.vtex.com/docs/guides/search-documents-in-master-data). + */ + _fields: string; + }; + url: '/api/dataentities/customFieldValues/documents/{locationId}'; +}; + +export type GetApiDataentitiesCustomFieldValuesDocumentsByLocationIdResponses = { + /** + * Location document object. + */ + 200: { + /** + * The ID of the location document. + */ + id?: string; + /** + * The ID of the data entity (`customFieldValues`). + */ + dataEntityId?: string; + /** + * Unique identifier of the VTEX account. + */ + accountId?: string; + /** + * Name of the VTEX account. + */ + accountName?: string; + /** + * Array of followers for this document. + */ + followers?: Array; + /** + * Array of schemas associated with this document. + */ + schemas?: Array; + /** + * The ID of the location setting to which this location belongs. + */ + customFieldId?: string; + /** + * The ID of the contract to which this location belongs. + */ + contractId?: string; + /** + * ID of the B2B address associated with this location. + */ + auxId?: string | null; + /** + * The actual value of the location. + */ + value?: string; + /** + * Optional description explaining what the value represents. + */ + description?: string | null; + /** + * ID of the user who created the document. + */ + createdBy?: string; + /** + * Metadata about the creator. + */ + createdBy_USER?: { + /** + * Unique identifier of the user. + */ + Id?: string; + /** + * Login email of the user. + */ + Login?: string; + /** + * Name of the user. + */ + Name?: string | null; + }; + /** + * Timestamp when the document was created. + */ + createdIn?: string; + /** + * ID of the last user who modified the document. + */ + lastInteractionBy?: string; + /** + * Metadata about the last interacting user. + */ + lastInteractionBy_USER?: { + /** + * Unique identifier of the user. + */ + Id?: string; + /** + * Login email of the user. + */ + Login?: string; + /** + * Name of the user. + */ + Name?: string | null; + }; + /** + * Timestamp of the last modification. + */ + lastInteractionIn?: string; + /** + * Tags associated with the document. + */ + Tags?: Array; + /** + * Unique identifier of the data instance. + */ + dataInstanceId?: string; + }; +}; + +export type GetApiDataentitiesCustomFieldValuesDocumentsByLocationIdResponse = GetApiDataentitiesCustomFieldValuesDocumentsByLocationIdResponses[keyof GetApiDataentitiesCustomFieldValuesDocumentsByLocationIdResponses]; + +export type PatchApiDataentitiesCustomFieldValuesDocumentsByLocationIdData = { + body?: LocationRequest; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path: { + /** + * Unique identifier of the location document. + */ + locationId: string; + }; + query?: never; + url: '/api/dataentities/customFieldValues/documents/{locationId}'; +}; + +export type PatchApiDataentitiesCustomFieldValuesDocumentsByLocationIdResponses = { + /** + * No Content + */ + 204: void; +}; + +export type PatchApiDataentitiesCustomFieldValuesDocumentsByLocationIdResponse = PatchApiDataentitiesCustomFieldValuesDocumentsByLocationIdResponses[keyof PatchApiDataentitiesCustomFieldValuesDocumentsByLocationIdResponses]; + +export type GetApiDataentitiesCustomFieldValuesSearchData = { + body?: never; + headers: { + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path?: never; + query: { + /** + * Master Data version. This field must be `v1`. + */ + _schema: string; + /** + * Comma-separated list of field names to be returned in the response. Use `_all` to return all fields, or specify individual fields like `id,contractId,value`. Learn more about [searching documents in Master Data v2](https://developers.vtex.com/docs/guides/search-documents-in-master-data). + */ + _fields: string; + /** + * Filter expression to search documents using Master Data v2 query syntax. You can combine multiple conditions using `AND`. Examples: + * - Get all locations for a contract: `contractId={{contractId}}` + * - Filter by contract and setting: `contractId={{contractId}} AND customFieldId="{{customFieldId}}"` + * - Filter by B2B address: `contractId={{contractId}} AND customFieldId="{{customFieldId}}" AND auxId="{{addressId}}"` + * - Filter by specific value: `contractId={{contractId}} AND customFieldId="{{customFieldId}}" AND value="{{value}}"` + * + * Learn more about [searching documents in Master Data v2](https://developers.vtex.com/docs/guides/search-documents-in-master-data). + */ + _where: string; + /** + * Defines the field and order for sorting results. Use the pattern `{fieldName} {ASC|DESC}`. For example, `value ASC` sorts results by the `value` field in ascending order. Learn more about [searching documents in Master Data v2](https://developers.vtex.com/docs/guides/search-documents-in-master-data). + */ + _sort?: string; + }; + url: '/api/dataentities/customFieldValues/search'; +}; + +export type GetApiDataentitiesCustomFieldValuesSearchResponses = { + /** + * Array of location objects matching the search criteria. + */ + 200: Array<{ + /** + * The unique ID of the location document. + */ + id?: string; + /** + * The ID of the contract associated with the location. + */ + contractId?: string; + /** + * The ID of the location setting to which this location belongs. + */ + customFieldId?: string; + /** + * ID of the B2B address associated with this location. + */ + auxId?: string | null; + /** + * The value stored for the location. + */ + value?: string; + /** + * Optional text describing what the value represents. + */ + description?: string | null; + }>; +}; + +export type GetApiDataentitiesCustomFieldValuesSearchResponse = GetApiDataentitiesCustomFieldValuesSearchResponses[keyof GetApiDataentitiesCustomFieldValuesSearchResponses]; diff --git a/vtex/server/generated/b2b-addresses/zod.gen.ts b/vtex/server/generated/b2b-addresses/zod.gen.ts new file mode 100644 index 00000000..de834b2c --- /dev/null +++ b/vtex/server/generated/b2b-addresses/zod.gen.ts @@ -0,0 +1,385 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import * as z from 'zod'; + +/** + * Request body object for creating or updating a B2B address. + */ +export const zCreateUpdateAddressRequests = z.object({ + addressName: z.optional(z.union([ + z.string(), + z.null() + ])), + addressLabel: z.optional(z.union([ + z.string(), + z.null() + ])), + addressType: z.enum(['commercial', 'invoice']), + receiverName: z.string(), + city: z.string(), + state: z.string(), + country: z.string(), + postalCode: z.string(), + street: z.string(), + number: z.string(), + neighborhood: z.optional(z.union([ + z.string(), + z.null() + ])), + complement: z.optional(z.union([ + z.string(), + z.null() + ])), + reference: z.optional(z.union([ + z.string(), + z.null() + ])), + geoCoordinates: z.optional(z.union([ + z.array(z.number()), + z.null() + ])), + userId: z.string() +}); + +/** + * Response body object for a created or updated document. + */ +export const zDocumentResponse = z.object({ + Id: z.string(), + Href: z.string() +}); + +/** + * Response body for a B2B address document. + */ +export const zAddressResponse = z.object({ + addressLabel: z.optional(z.union([ + z.string(), + z.null() + ])), + addressType: z.optional(z.enum(['commercial', 'invoice'])), + city: z.optional(z.union([ + z.string(), + z.null() + ])), + complement: z.optional(z.union([ + z.string(), + z.null() + ])), + country: z.optional(z.union([ + z.string(), + z.null() + ])), + geoCoordinates: z.optional(z.union([ + z.array(z.number()), + z.null() + ])), + neighborhood: z.optional(z.union([ + z.string(), + z.null() + ])), + number: z.optional(z.union([ + z.string(), + z.null() + ])), + postalCode: z.optional(z.union([ + z.string(), + z.null() + ])), + receiverName: z.optional(z.union([ + z.string(), + z.null() + ])), + reference: z.optional(z.union([ + z.string(), + z.null() + ])), + state: z.optional(z.union([ + z.string(), + z.null() + ])), + street: z.optional(z.union([ + z.string(), + z.null() + ])), + userId: z.optional(z.union([ + z.string(), + z.null() + ])), + id: z.optional(z.union([ + z.string(), + z.null() + ])), + accountId: z.optional(z.union([ + z.string(), + z.null() + ])), + accountName: z.optional(z.union([ + z.string(), + z.null() + ])), + dataEntityId: z.optional(z.union([ + z.string(), + z.null() + ])), + createdBy: z.optional(z.union([ + z.string(), + z.null() + ])), + createdIn: z.optional(z.union([ + z.string(), + z.null() + ])), + updatedBy: z.optional(z.union([ + z.string(), + z.null() + ])), + updatedIn: z.optional(z.union([ + z.string(), + z.null() + ])), + lastInteractionBy: z.optional(z.union([ + z.string(), + z.null() + ])), + lastInteractionIn: z.optional(z.union([ + z.string(), + z.null() + ])), + followers: z.optional(z.union([ + z.array(z.string()), + z.null() + ])), + tags: z.optional(z.union([ + z.array(z.string()), + z.null() + ])) +}); + +/** + * Recipient document object. A recipient can be associated with one or more B2B addresses through the `addressIds` field. + */ +export const zRecipientRequest = z.object({ + email: z.optional(z.string()), + firstName: z.string(), + lastName: z.string(), + profileId: z.optional(z.uuid()), + phone: z.optional(z.string()), + phoneExtension: z.optional(z.string()), + document: z.optional(z.string()), + documentType: z.optional(z.string()), + addressIds: z.optional(z.array(z.uuid())) +}); + +/** + * Location object. A location is a value of a [custom checkout field](https://developers.vtex.com/docs/guides/custom-fields-integration) associated with a B2B address through the `auxId` field. + */ +export const zLocationRequest = z.object({ + contractId: z.string(), + customFieldId: z.string(), + auxId: z.string(), + value: z.string(), + description: z.optional(z.string()) +}); + +/** + * Type of the content being sent. + */ +export const zContentType = z.string().default('application/json'); + +/** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ +export const zAccept = z.string().default('application/json'); + +/** + * Comma-separated list of field names to be returned in the response. This query string parameter allows you to specify which fields to include. Use `_all` to return all fields, or specify individual fields like `id,contractId,value`. Learn more about [searching documents in Master Data v2](https://developers.vtex.com/docs/guides/search-documents-in-master-data). + */ +export const zFields = z.string(); + +/** + * Unique identifier of the location document. + */ +export const zLocationId = z.string(); + +export const zPostApiDataentitiesAdDocumentsData = z.object({ + body: z.optional(zCreateUpdateAddressRequests), + path: z.optional(z.never()), + query: z.optional(z.never()), + headers: z.object({ + 'Content-Type': z.string().default('application/json'), + Accept: z.string().default('application/json') + }) +}); + +export const zGetApiDataentitiesAdSearchData = z.object({ + body: z.optional(z.never()), + path: z.optional(z.never()), + query: z.optional(z.object({ + _fields: z.optional(z.string()), + _where: z.optional(z.string()), + _sort: z.optional(z.string()) + })), + headers: z.object({ + Accept: z.string().default('application/json'), + 'REST-Range': z.string() + }) +}); + +export const zDeleteApiDataentitiesAdDocumentsByAddressIdData = z.object({ + body: z.optional(z.never()), + path: z.object({ + addressId: z.string() + }), + query: z.optional(z.never()), + headers: z.object({ + Accept: z.string().default('application/json') + }) +}); + +export const zGetApiDataentitiesAdDocumentsByAddressIdData = z.object({ + body: z.optional(z.never()), + path: z.object({ + addressId: z.string() + }), + query: z.optional(z.object({ + _fields: z.optional(z.string()).default('_all') + })), + headers: z.object({ + Accept: z.string().default('application/json') + }) +}); + +export const zPatchApiDataentitiesAdDocumentsByAddressIdData = z.object({ + body: z.optional(zCreateUpdateAddressRequests), + path: z.object({ + addressId: z.string() + }), + query: z.optional(z.never()), + headers: z.object({ + 'Content-Type': z.string().default('application/json'), + Accept: z.string().default('application/json') + }) +}); + +export const zPostApiDataentitiesContactInformationDocumentsData = z.object({ + body: z.optional(zRecipientRequest), + path: z.optional(z.never()), + query: z.optional(z.never()), + headers: z.object({ + 'Content-Type': z.string().default('application/json'), + Accept: z.string().default('application/json') + }) +}); + +export const zGetApiDataentitiesContactInformationSearchData = z.object({ + body: z.optional(z.never()), + path: z.optional(z.never()), + query: z.object({ + _where: z.string(), + _fields: z.optional(z.string()), + _schema: z.string().default('v1') + }), + headers: z.object({ + Accept: z.string().default('application/json') + }) +}); + +export const zDeleteApiDataentitiesContactInformationDocumentsByRecipientIdData = z.object({ + body: z.optional(z.never()), + path: z.object({ + recipientId: z.string() + }), + query: z.optional(z.never()), + headers: z.object({ + Accept: z.string().default('application/json') + }) +}); + +export const zGetApiDataentitiesContactInformationDocumentsByRecipientIdData = z.object({ + body: z.optional(z.never()), + path: z.object({ + recipientId: z.string() + }), + query: z.object({ + _fields: z.optional(z.string()), + _schema: z.string().default('v1') + }), + headers: z.object({ + Accept: z.string().default('application/json') + }) +}); + +export const zPatchApiDataentitiesContactInformationDocumentsByRecipientIdData = z.object({ + body: z.optional(zRecipientRequest), + path: z.object({ + recipientId: z.string() + }), + query: z.optional(z.never()), + headers: z.object({ + 'Content-Type': z.string().default('application/json'), + Accept: z.string().default('application/json') + }) +}); + +export const zPostApiDataentitiesCustomFieldValuesDocumentsData = z.object({ + body: z.optional(zLocationRequest), + path: z.optional(z.never()), + query: z.optional(z.never()), + headers: z.object({ + 'Content-Type': z.string().default('application/json'), + Accept: z.string().default('application/json') + }) +}); + +export const zDeleteApiDataentitiesCustomFieldValuesDocumentsByLocationIdData = z.object({ + body: z.optional(z.never()), + path: z.object({ + locationId: z.string() + }), + query: z.object({ + _fields: z.string() + }), + headers: z.object({ + Accept: z.string().default('application/json') + }) +}); + +export const zGetApiDataentitiesCustomFieldValuesDocumentsByLocationIdData = z.object({ + body: z.optional(z.never()), + path: z.object({ + locationId: z.string() + }), + query: z.object({ + _fields: z.string() + }), + headers: z.object({ + Accept: z.string().default('application/json') + }) +}); + +export const zPatchApiDataentitiesCustomFieldValuesDocumentsByLocationIdData = z.object({ + body: z.optional(zLocationRequest), + path: z.object({ + locationId: z.string() + }), + query: z.optional(z.never()), + headers: z.object({ + 'Content-Type': z.string().default('application/json'), + Accept: z.string().default('application/json') + }) +}); + +export const zGetApiDataentitiesCustomFieldValuesSearchData = z.object({ + body: z.optional(z.never()), + path: z.optional(z.never()), + query: z.object({ + _schema: z.string(), + _fields: z.string(), + _where: z.string(), + _sort: z.optional(z.string()) + }), + headers: z.object({ + Accept: z.string().default('application/json') + }) +}); diff --git a/vtex/server/generated/b2b-buyer-data/types.gen.ts b/vtex/server/generated/b2b-buyer-data/types.gen.ts index df50908c..c370c689 100644 --- a/vtex/server/generated/b2b-buyer-data/types.gen.ts +++ b/vtex/server/generated/b2b-buyer-data/types.gen.ts @@ -248,7 +248,7 @@ export type BuyerSchemaResponse = { */ export type BuyerDocumentRequest = { /** - * Unique identifier for the buyer created by [VTEX ID API](https://developers.vtex.com/docs/api-reference/vtex-id-api#post-/api/authenticator/storefront/users). + * Unique identifier for the buyer created by [VTEX ID API](https://developers.vtex.com/docs/api-reference/vtex-id-api#post-/api/authenticator/v1/storefront/users). */ userId: string; /** @@ -282,7 +282,7 @@ export type BuyerDocumentRequest = { */ export type BuyerDocument = { /** - * Unique identifier for the buyer created by [VTEX ID API](https://developers.vtex.com/docs/api-reference/vtex-id-api#post-/api/authenticator/storefront/users). + * Unique identifier for the buyer created by [VTEX ID API](https://developers.vtex.com/docs/api-reference/vtex-id-api#post-/api/authenticator/v1/storefront/users). */ userId?: string; /** @@ -469,7 +469,7 @@ export type DeleteApiDataentitiesShopperDocumentsByBuyerIdData = { }; path: { /** - * Unique identifier for the buyer created by [VTEX ID API](https://developers.vtex.com/docs/api-reference/vtex-id-api#post-/api/authenticator/storefront/users). + * Unique identifier for the buyer created by [VTEX ID API](https://developers.vtex.com/docs/api-reference/vtex-id-api#post-/api/authenticator/v1/storefront/users). */ buyerId: string; }; @@ -504,7 +504,7 @@ export type GetApiDataentitiesShopperDocumentsByBuyerIdData = { }; path: { /** - * Unique identifier for the buyer created by [VTEX ID API](https://developers.vtex.com/docs/api-reference/vtex-id-api#post-/api/authenticator/storefront/users). + * Unique identifier for the buyer created by [VTEX ID API](https://developers.vtex.com/docs/api-reference/vtex-id-api#post-/api/authenticator/v1/storefront/users). */ buyerId: string; }; @@ -531,7 +531,7 @@ export type PatchApiDataentitiesShopperDocumentsByBuyerIdData = { }; path: { /** - * Unique identifier for the buyer created by [VTEX ID API](https://developers.vtex.com/docs/api-reference/vtex-id-api#post-/api/authenticator/storefront/users). + * Unique identifier for the buyer created by [VTEX ID API](https://developers.vtex.com/docs/api-reference/vtex-id-api#post-/api/authenticator/v1/storefront/users). */ buyerId: string; }; @@ -563,7 +563,7 @@ export type GetApiDataentitiesShopperSearchData = { path?: never; query: { /** - * Unique identifier for the buyer created by [VTEX ID API](https://developers.vtex.com/docs/api-reference/vtex-id-api#post-/api/authenticator/storefront/users). Use the `userId={{userId}}` value. + * Unique identifier for the buyer created by [VTEX ID API](https://developers.vtex.com/docs/api-reference/vtex-id-api#post-/api/authenticator/v1/storefront/users). Use the `userId={{userId}}` value. */ _where?: string; /** diff --git a/vtex/server/generated/b2b-contracts/sdk.gen.ts b/vtex/server/generated/b2b-contracts/sdk.gen.ts index 0879d22f..3bd766b0 100644 --- a/vtex/server/generated/b2b-contracts/sdk.gen.ts +++ b/vtex/server/generated/b2b-contracts/sdk.gen.ts @@ -29,9 +29,9 @@ export type Options ⚠️ When updating contracts you must send each field according to the specifications provided. Otherwise, the Checkout module will not be able to autofill data during the shopping flow, which can block the purchase. Learn more about [SmartCheckout - Customer information automatic fill-in](https://help.vtex.com/en/tutorial/smartcheckout-preenchimento-automatico-de-dados-do-cliente--2Nuu3xAFzdhIzJIldAdtan#). * * >⚠️ This feature is only available for stores using B2B Buyer Portal, which is currently available to select accounts. * + * **Note**: The following restriction fields are accepted: + * + * - `vtex.catalog.assortmentIds` + * - `vtex.checkout.creditCards` + * - `vtex.payments.paymentSystemIds` + * * ## Permissions * * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: diff --git a/vtex/server/generated/b2b-contracts/types.gen.ts b/vtex/server/generated/b2b-contracts/types.gen.ts index da33e3fa..7538a93f 100644 --- a/vtex/server/generated/b2b-contracts/types.gen.ts +++ b/vtex/server/generated/b2b-contracts/types.gen.ts @@ -69,13 +69,13 @@ export type UpdateContractRequest = { */ restrictions?: { /** - * Contains restrictions regarding catalog. + * Contains catalog restrictions for the contract. */ 'vtex.catalog'?: { /** - * A list of collection IDs that define which product collections (sets of SKUs) the B2B customer can view or purchase from. + * IDs of product assortments authorized for this contract (maximum of 20). An assortment is a reusable, merchant-level catalog profile, built from inclusion and exclusion collections, that controls which SKUs buyers can browse and purchase. This field defines the allowlist at the contract level. When empty, buyers fall back to the Sales Channel catalog associated with their navigation context. Organization Unit managers select one active assortment from this allowlist for their unit. Assortments supersede the legacy `collectionIds` restriction. */ - collectionIds?: Array; + assortmentIds?: Array; }; /** * Contains restrictions regarding checkout. @@ -221,13 +221,13 @@ export type ContractResponse = { */ restrictions?: { /** - * Contains restrictions regarding catalog. + * Contains catalog restrictions for the contract. */ 'vtex.catalog'?: { /** - * A list of collection IDs that define which product collections (sets of SKUs) the B2B customer can view or purchase from. + * IDs of product assortments authorized for this contract (maximum of 20). An assortment is a reusable, merchant-level catalog profile, built from inclusion and exclusion collections, that controls which SKUs buyers can browse and purchase. This field defines the allowlist at the contract level. When empty, buyers fall back to the Sales Channel catalog associated with their navigation context. Organization Unit managers select one active assortment from this allowlist for their unit. Assortments supersede the legacy `collectionIds` restriction. */ - collectionIds?: Array; + assortmentIds?: Array; }; /** * Contains restrictions regarding checkout. diff --git a/vtex/server/generated/b2b-contracts/zod.gen.ts b/vtex/server/generated/b2b-contracts/zod.gen.ts index 779627b5..14941836 100644 --- a/vtex/server/generated/b2b-contracts/zod.gen.ts +++ b/vtex/server/generated/b2b-contracts/zod.gen.ts @@ -22,7 +22,7 @@ export const zUpdateContractRequest = z.object({ priceTables: z.optional(z.string()), restrictions: z.optional(z.object({ 'vtex.catalog': z.optional(z.object({ - collectionIds: z.optional(z.array(z.string())) + assortmentIds: z.optional(z.array(z.string())) })), 'vtex.checkout': z.optional(z.object({ creditCards: z.optional(z.array(z.string())) @@ -145,7 +145,7 @@ export const zContractResponse = z.object({ restrictions: z.optional(z.union([ z.object({ 'vtex.catalog': z.optional(z.object({ - collectionIds: z.optional(z.array(z.string())) + assortmentIds: z.optional(z.array(z.string())) })), 'vtex.checkout': z.optional(z.object({ creditCards: z.optional(z.array(z.string())) diff --git a/vtex/server/generated/b2b-password-migration-protocol/client.gen.ts b/vtex/server/generated/b2b-password-migration-protocol/client.gen.ts new file mode 100644 index 00000000..cab3c701 --- /dev/null +++ b/vtex/server/generated/b2b-password-migration-protocol/client.gen.ts @@ -0,0 +1,16 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { type ClientOptions, type Config, createClient, createConfig } from './client'; +import type { ClientOptions as ClientOptions2 } from './types.gen'; + +/** + * The `createClientConfig()` function will be called on client initialization + * and the returned object will become the client's initial configuration. + * + * You may want to initialize your client this way instead of calling + * `setConfig()`. This is useful for example if you're using Next.js + * to ensure your client always has the correct values. + */ +export type CreateClientConfig = (override?: Config) => Config & T>; + +export const client = createClient(createConfig()); diff --git a/vtex/server/generated/b2b-password-migration-protocol/client/client.gen.ts b/vtex/server/generated/b2b-password-migration-protocol/client/client.gen.ts new file mode 100644 index 00000000..d2e55a14 --- /dev/null +++ b/vtex/server/generated/b2b-password-migration-protocol/client/client.gen.ts @@ -0,0 +1,288 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { createSseClient } from '../core/serverSentEvents.gen'; +import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; +import type { Client, Config, RequestOptions, ResolvedRequestOptions } from './types.gen'; +import { + buildUrl, + createConfig, + createInterceptors, + getParseAs, + mergeConfigs, + mergeHeaders, + setAuthParams, +} from './utils.gen'; + +type ReqInit = Omit & { + body?: any; + headers: ReturnType; +}; + +export const createClient = (config: Config = {}): Client => { + let _config = mergeConfigs(createConfig(), config); + + const getConfig = (): Config => ({ ..._config }); + + const setConfig = (config: Config): Config => { + _config = mergeConfigs(_config, config); + return getConfig(); + }; + + const interceptors = createInterceptors(); + + const beforeRequest = async (options: RequestOptions) => { + const opts = { + ..._config, + ...options, + fetch: options.fetch ?? _config.fetch ?? globalThis.fetch, + headers: mergeHeaders(_config.headers, options.headers), + serializedBody: undefined, + }; + + if (opts.security) { + await setAuthParams({ + ...opts, + security: opts.security, + }); + } + + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + + if (opts.body !== undefined && opts.bodySerializer) { + opts.serializedBody = opts.bodySerializer(opts.body); + } + + // remove Content-Type header if body is empty to avoid sending invalid requests + if (opts.body === undefined || opts.serializedBody === '') { + opts.headers.delete('Content-Type'); + } + + const url = buildUrl(opts); + + return { opts, url }; + }; + + const request: Client['request'] = async (options) => { + // @ts-expect-error + const { opts, url } = await beforeRequest(options); + const requestInit: ReqInit = { + redirect: 'follow', + ...opts, + body: getValidRequestBody(opts), + }; + + let request = new Request(url, requestInit); + + for (const fn of interceptors.request.fns) { + if (fn) { + request = await fn(request, opts); + } + } + + // fetch must be assigned here, otherwise it would throw the error: + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation + const _fetch = opts.fetch!; + let response: Response; + + try { + response = await _fetch(request); + } catch (error) { + // Handle fetch exceptions (AbortError, network errors, etc.) + let finalError = error; + + for (const fn of interceptors.error.fns) { + if (fn) { + finalError = (await fn(error, undefined as any, request, opts)) as unknown; + } + } + + finalError = finalError || ({} as unknown); + + if (opts.throwOnError) { + throw finalError; + } + + // Return error response + return opts.responseStyle === 'data' + ? undefined + : { + error: finalError, + request, + response: undefined as any, + }; + } + + for (const fn of interceptors.response.fns) { + if (fn) { + response = await fn(response, request, opts); + } + } + + const result = { + request, + response, + }; + + if (response.ok) { + const parseAs = + (opts.parseAs === 'auto' + ? getParseAs(response.headers.get('Content-Type')) + : opts.parseAs) ?? 'json'; + + if (response.status === 204 || response.headers.get('Content-Length') === '0') { + let emptyData: any; + switch (parseAs) { + case 'arrayBuffer': + case 'blob': + case 'text': + emptyData = await response[parseAs](); + break; + case 'formData': + emptyData = new FormData(); + break; + case 'stream': + emptyData = response.body; + break; + case 'json': + default: + emptyData = {}; + break; + } + return opts.responseStyle === 'data' + ? emptyData + : { + data: emptyData, + ...result, + }; + } + + let data: any; + switch (parseAs) { + case 'arrayBuffer': + case 'blob': + case 'formData': + case 'text': + data = await response[parseAs](); + break; + case 'json': { + // Some servers return 200 with no Content-Length and empty body. + // response.json() would throw; read as text and parse if non-empty. + const text = await response.text(); + data = text ? JSON.parse(text) : {}; + break; + } + case 'stream': + return opts.responseStyle === 'data' + ? response.body + : { + data: response.body, + ...result, + }; + } + + if (parseAs === 'json') { + if (opts.responseValidator) { + await opts.responseValidator(data); + } + + if (opts.responseTransformer) { + data = await opts.responseTransformer(data); + } + } + + return opts.responseStyle === 'data' + ? data + : { + data, + ...result, + }; + } + + const textError = await response.text(); + let jsonError: unknown; + + try { + jsonError = JSON.parse(textError); + } catch { + // noop + } + + const error = jsonError ?? textError; + let finalError = error; + + for (const fn of interceptors.error.fns) { + if (fn) { + finalError = (await fn(error, response, request, opts)) as string; + } + } + + finalError = finalError || ({} as string); + + if (opts.throwOnError) { + throw finalError; + } + + // TODO: we probably want to return error and improve types + return opts.responseStyle === 'data' + ? undefined + : { + error: finalError, + ...result, + }; + }; + + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => + request({ ...options, method }); + + const makeSseFn = (method: Uppercase) => async (options: RequestOptions) => { + const { opts, url } = await beforeRequest(options); + return createSseClient({ + ...opts, + body: opts.body as BodyInit | null | undefined, + headers: opts.headers as unknown as Record, + method, + onRequest: async (url, init) => { + let request = new Request(url, init); + for (const fn of interceptors.request.fns) { + if (fn) { + request = await fn(request, opts); + } + } + return request; + }, + serializedBody: getValidRequestBody(opts) as BodyInit | null | undefined, + url, + }); + }; + + return { + buildUrl, + connect: makeMethodFn('CONNECT'), + delete: makeMethodFn('DELETE'), + get: makeMethodFn('GET'), + getConfig, + head: makeMethodFn('HEAD'), + interceptors, + options: makeMethodFn('OPTIONS'), + patch: makeMethodFn('PATCH'), + post: makeMethodFn('POST'), + put: makeMethodFn('PUT'), + request, + setConfig, + sse: { + connect: makeSseFn('CONNECT'), + delete: makeSseFn('DELETE'), + get: makeSseFn('GET'), + head: makeSseFn('HEAD'), + options: makeSseFn('OPTIONS'), + patch: makeSseFn('PATCH'), + post: makeSseFn('POST'), + put: makeSseFn('PUT'), + trace: makeSseFn('TRACE'), + }, + trace: makeMethodFn('TRACE'), + } as Client; +}; diff --git a/vtex/server/generated/b2b-password-migration-protocol/client/index.ts b/vtex/server/generated/b2b-password-migration-protocol/client/index.ts new file mode 100644 index 00000000..b295edec --- /dev/null +++ b/vtex/server/generated/b2b-password-migration-protocol/client/index.ts @@ -0,0 +1,25 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type { Auth } from '../core/auth.gen'; +export type { QuerySerializerOptions } from '../core/bodySerializer.gen'; +export { + formDataBodySerializer, + jsonBodySerializer, + urlSearchParamsBodySerializer, +} from '../core/bodySerializer.gen'; +export { buildClientParams } from '../core/params.gen'; +export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen'; +export { createClient } from './client.gen'; +export type { + Client, + ClientOptions, + Config, + CreateClientConfig, + Options, + RequestOptions, + RequestResult, + ResolvedRequestOptions, + ResponseStyle, + TDataShape, +} from './types.gen'; +export { createConfig, mergeHeaders } from './utils.gen'; diff --git a/vtex/server/generated/b2b-password-migration-protocol/client/types.gen.ts b/vtex/server/generated/b2b-password-migration-protocol/client/types.gen.ts new file mode 100644 index 00000000..cb6d0d54 --- /dev/null +++ b/vtex/server/generated/b2b-password-migration-protocol/client/types.gen.ts @@ -0,0 +1,213 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Auth } from '../core/auth.gen'; +import type { + ServerSentEventsOptions, + ServerSentEventsResult, +} from '../core/serverSentEvents.gen'; +import type { Client as CoreClient, Config as CoreConfig } from '../core/types.gen'; +import type { Middleware } from './utils.gen'; + +export type ResponseStyle = 'data' | 'fields'; + +export interface Config + extends Omit, CoreConfig { + /** + * Base URL for all requests made by this client. + */ + baseUrl?: T['baseUrl']; + /** + * Fetch API implementation. You can use this option to provide a custom + * fetch instance. + * + * @default globalThis.fetch + */ + fetch?: typeof fetch; + /** + * Please don't use the Fetch client for Next.js applications. The `next` + * options won't have any effect. + * + * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead. + */ + next?: never; + /** + * Return the response data parsed in a specified format. By default, `auto` + * will infer the appropriate method from the `Content-Type` response header. + * You can override this behavior with any of the {@link Body} methods. + * Select `stream` if you don't want to parse response data at all. + * + * @default 'auto' + */ + parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text'; + /** + * Should we return only data or multiple fields (data, error, response, etc.)? + * + * @default 'fields' + */ + responseStyle?: ResponseStyle; + /** + * Throw an error instead of returning it in the response? + * + * @default false + */ + throwOnError?: T['throwOnError']; +} + +export interface RequestOptions< + TData = unknown, + TResponseStyle extends ResponseStyle = 'fields', + ThrowOnError extends boolean = boolean, + Url extends string = string, +> + extends + Config<{ + responseStyle: TResponseStyle; + throwOnError: ThrowOnError; + }>, + Pick< + ServerSentEventsOptions, + | 'onSseError' + | 'onSseEvent' + | 'sseDefaultRetryDelay' + | 'sseMaxRetryAttempts' + | 'sseMaxRetryDelay' + > { + /** + * Any body that you want to add to your request. + * + * {@link https://developer.mozilla.org/docs/Web/API/fetch#body} + */ + body?: unknown; + path?: Record; + query?: Record; + /** + * Security mechanism(s) to use for the request. + */ + security?: ReadonlyArray; + url: Url; +} + +export interface ResolvedRequestOptions< + TResponseStyle extends ResponseStyle = 'fields', + ThrowOnError extends boolean = boolean, + Url extends string = string, +> extends RequestOptions { + serializedBody?: string; +} + +export type RequestResult< + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = boolean, + TResponseStyle extends ResponseStyle = 'fields', +> = ThrowOnError extends true + ? Promise< + TResponseStyle extends 'data' + ? TData extends Record + ? TData[keyof TData] + : TData + : { + data: TData extends Record ? TData[keyof TData] : TData; + request: Request; + response: Response; + } + > + : Promise< + TResponseStyle extends 'data' + ? (TData extends Record ? TData[keyof TData] : TData) | undefined + : ( + | { + data: TData extends Record ? TData[keyof TData] : TData; + error: undefined; + } + | { + data: undefined; + error: TError extends Record ? TError[keyof TError] : TError; + } + ) & { + request: Request; + response: Response; + } + >; + +export interface ClientOptions { + baseUrl?: string; + responseStyle?: ResponseStyle; + throwOnError?: boolean; +} + +type MethodFn = < + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = false, + TResponseStyle extends ResponseStyle = 'fields', +>( + options: Omit, 'method'>, +) => RequestResult; + +type SseFn = < + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = false, + TResponseStyle extends ResponseStyle = 'fields', +>( + options: Omit, 'method'>, +) => Promise>; + +type RequestFn = < + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = false, + TResponseStyle extends ResponseStyle = 'fields', +>( + options: Omit, 'method'> & + Pick>, 'method'>, +) => RequestResult; + +type BuildUrlFn = < + TData extends { + body?: unknown; + path?: Record; + query?: Record; + url: string; + }, +>( + options: TData & Options, +) => string; + +export type Client = CoreClient & { + interceptors: Middleware; +}; + +/** + * The `createClientConfig()` function will be called on client initialization + * and the returned object will become the client's initial configuration. + * + * You may want to initialize your client this way instead of calling + * `setConfig()`. This is useful for example if you're using Next.js + * to ensure your client always has the correct values. + */ +export type CreateClientConfig = ( + override?: Config, +) => Config & T>; + +export interface TDataShape { + body?: unknown; + headers?: unknown; + path?: unknown; + query?: unknown; + url: string; +} + +type OmitKeys = Pick>; + +export type Options< + TData extends TDataShape = TDataShape, + ThrowOnError extends boolean = boolean, + TResponse = unknown, + TResponseStyle extends ResponseStyle = 'fields', +> = OmitKeys< + RequestOptions, + 'body' | 'path' | 'query' | 'url' +> & + ([TData] extends [never] ? unknown : Omit); diff --git a/vtex/server/generated/b2b-password-migration-protocol/client/utils.gen.ts b/vtex/server/generated/b2b-password-migration-protocol/client/utils.gen.ts new file mode 100644 index 00000000..b4bd2435 --- /dev/null +++ b/vtex/server/generated/b2b-password-migration-protocol/client/utils.gen.ts @@ -0,0 +1,316 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { getAuthToken } from '../core/auth.gen'; +import type { QuerySerializerOptions } from '../core/bodySerializer.gen'; +import { jsonBodySerializer } from '../core/bodySerializer.gen'; +import { + serializeArrayParam, + serializeObjectParam, + serializePrimitiveParam, +} from '../core/pathSerializer.gen'; +import { getUrl } from '../core/utils.gen'; +import type { Client, ClientOptions, Config, RequestOptions } from './types.gen'; + +export const createQuerySerializer = ({ + parameters = {}, + ...args +}: QuerySerializerOptions = {}) => { + const querySerializer = (queryParams: T) => { + const search: string[] = []; + if (queryParams && typeof queryParams === 'object') { + for (const name in queryParams) { + const value = queryParams[name]; + + if (value === undefined || value === null) { + continue; + } + + const options = parameters[name] || args; + + if (Array.isArray(value)) { + const serializedArray = serializeArrayParam({ + allowReserved: options.allowReserved, + explode: true, + name, + style: 'form', + value, + ...options.array, + }); + if (serializedArray) search.push(serializedArray); + } else if (typeof value === 'object') { + const serializedObject = serializeObjectParam({ + allowReserved: options.allowReserved, + explode: true, + name, + style: 'deepObject', + value: value as Record, + ...options.object, + }); + if (serializedObject) search.push(serializedObject); + } else { + const serializedPrimitive = serializePrimitiveParam({ + allowReserved: options.allowReserved, + name, + value: value as string, + }); + if (serializedPrimitive) search.push(serializedPrimitive); + } + } + } + return search.join('&'); + }; + return querySerializer; +}; + +/** + * Infers parseAs value from provided Content-Type header. + */ +export const getParseAs = (contentType: string | null): Exclude => { + if (!contentType) { + // If no Content-Type header is provided, the best we can do is return the raw response body, + // which is effectively the same as the 'stream' option. + return 'stream'; + } + + const cleanContent = contentType.split(';')[0]?.trim(); + + if (!cleanContent) { + return; + } + + if (cleanContent.startsWith('application/json') || cleanContent.endsWith('+json')) { + return 'json'; + } + + if (cleanContent === 'multipart/form-data') { + return 'formData'; + } + + if ( + ['application/', 'audio/', 'image/', 'video/'].some((type) => cleanContent.startsWith(type)) + ) { + return 'blob'; + } + + if (cleanContent.startsWith('text/')) { + return 'text'; + } + + return; +}; + +const checkForExistence = ( + options: Pick & { + headers: Headers; + }, + name?: string, +): boolean => { + if (!name) { + return false; + } + if ( + options.headers.has(name) || + options.query?.[name] || + options.headers.get('Cookie')?.includes(`${name}=`) + ) { + return true; + } + return false; +}; + +export const setAuthParams = async ({ + security, + ...options +}: Pick, 'security'> & + Pick & { + headers: Headers; + }) => { + for (const auth of security) { + if (checkForExistence(options, auth.name)) { + continue; + } + + const token = await getAuthToken(auth, options.auth); + + if (!token) { + continue; + } + + const name = auth.name ?? 'Authorization'; + + switch (auth.in) { + case 'query': + if (!options.query) { + options.query = {}; + } + options.query[name] = token; + break; + case 'cookie': + options.headers.append('Cookie', `${name}=${token}`); + break; + case 'header': + default: + options.headers.set(name, token); + break; + } + } +}; + +export const buildUrl: Client['buildUrl'] = (options) => + getUrl({ + baseUrl: options.baseUrl as string, + path: options.path, + query: options.query, + querySerializer: + typeof options.querySerializer === 'function' + ? options.querySerializer + : createQuerySerializer(options.querySerializer), + url: options.url, + }); + +export const mergeConfigs = (a: Config, b: Config): Config => { + const config = { ...a, ...b }; + if (config.baseUrl?.endsWith('/')) { + config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1); + } + config.headers = mergeHeaders(a.headers, b.headers); + return config; +}; + +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + +export const mergeHeaders = ( + ...headers: Array['headers'] | undefined> +): Headers => { + const mergedHeaders = new Headers(); + for (const header of headers) { + if (!header) { + continue; + } + + const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header); + + for (const [key, value] of iterator) { + if (value === null) { + mergedHeaders.delete(key); + } else if (Array.isArray(value)) { + for (const v of value) { + mergedHeaders.append(key, v as string); + } + } else if (value !== undefined) { + // assume object headers are meant to be JSON stringified, i.e. their + // content value in OpenAPI specification is 'application/json' + mergedHeaders.set( + key, + typeof value === 'object' ? JSON.stringify(value) : (value as string), + ); + } + } + } + return mergedHeaders; +}; + +type ErrInterceptor = ( + error: Err, + response: Res, + request: Req, + options: Options, +) => Err | Promise; + +type ReqInterceptor = (request: Req, options: Options) => Req | Promise; + +type ResInterceptor = ( + response: Res, + request: Req, + options: Options, +) => Res | Promise; + +class Interceptors { + fns: Array = []; + + clear(): void { + this.fns = []; + } + + eject(id: number | Interceptor): void { + const index = this.getInterceptorIndex(id); + if (this.fns[index]) { + this.fns[index] = null; + } + } + + exists(id: number | Interceptor): boolean { + const index = this.getInterceptorIndex(id); + return Boolean(this.fns[index]); + } + + getInterceptorIndex(id: number | Interceptor): number { + if (typeof id === 'number') { + return this.fns[id] ? id : -1; + } + return this.fns.indexOf(id); + } + + update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false { + const index = this.getInterceptorIndex(id); + if (this.fns[index]) { + this.fns[index] = fn; + return id; + } + return false; + } + + use(fn: Interceptor): number { + this.fns.push(fn); + return this.fns.length - 1; + } +} + +export interface Middleware { + error: Interceptors>; + request: Interceptors>; + response: Interceptors>; +} + +export const createInterceptors = (): Middleware< + Req, + Res, + Err, + Options +> => ({ + error: new Interceptors>(), + request: new Interceptors>(), + response: new Interceptors>(), +}); + +const defaultQuerySerializer = createQuerySerializer({ + allowReserved: false, + array: { + explode: true, + style: 'form', + }, + object: { + explode: true, + style: 'deepObject', + }, +}); + +const defaultHeaders = { + 'Content-Type': 'application/json', +}; + +export const createConfig = ( + override: Config & T> = {}, +): Config & T> => ({ + ...jsonBodySerializer, + headers: defaultHeaders, + parseAs: 'auto', + querySerializer: defaultQuerySerializer, + ...override, +}); diff --git a/vtex/server/generated/b2b-password-migration-protocol/core/auth.gen.ts b/vtex/server/generated/b2b-password-migration-protocol/core/auth.gen.ts new file mode 100644 index 00000000..3ebf9947 --- /dev/null +++ b/vtex/server/generated/b2b-password-migration-protocol/core/auth.gen.ts @@ -0,0 +1,41 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type AuthToken = string | undefined; + +export interface Auth { + /** + * Which part of the request do we use to send the auth? + * + * @default 'header' + */ + in?: 'header' | 'query' | 'cookie'; + /** + * Header or query parameter name. + * + * @default 'Authorization' + */ + name?: string; + scheme?: 'basic' | 'bearer'; + type: 'apiKey' | 'http'; +} + +export const getAuthToken = async ( + auth: Auth, + callback: ((auth: Auth) => Promise | AuthToken) | AuthToken, +): Promise => { + const token = typeof callback === 'function' ? await callback(auth) : callback; + + if (!token) { + return; + } + + if (auth.scheme === 'bearer') { + return `Bearer ${token}`; + } + + if (auth.scheme === 'basic') { + return `Basic ${btoa(token)}`; + } + + return token; +}; diff --git a/vtex/server/generated/b2b-password-migration-protocol/core/bodySerializer.gen.ts b/vtex/server/generated/b2b-password-migration-protocol/core/bodySerializer.gen.ts new file mode 100644 index 00000000..8ad92c9f --- /dev/null +++ b/vtex/server/generated/b2b-password-migration-protocol/core/bodySerializer.gen.ts @@ -0,0 +1,84 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { ArrayStyle, ObjectStyle, SerializerOptions } from './pathSerializer.gen'; + +export type QuerySerializer = (query: Record) => string; + +export type BodySerializer = (body: any) => any; + +type QuerySerializerOptionsObject = { + allowReserved?: boolean; + array?: Partial>; + object?: Partial>; +}; + +export type QuerySerializerOptions = QuerySerializerOptionsObject & { + /** + * Per-parameter serialization overrides. When provided, these settings + * override the global array/object settings for specific parameter names. + */ + parameters?: Record; +}; + +const serializeFormDataPair = (data: FormData, key: string, value: unknown): void => { + if (typeof value === 'string' || value instanceof Blob) { + data.append(key, value); + } else if (value instanceof Date) { + data.append(key, value.toISOString()); + } else { + data.append(key, JSON.stringify(value)); + } +}; + +const serializeUrlSearchParamsPair = (data: URLSearchParams, key: string, value: unknown): void => { + if (typeof value === 'string') { + data.append(key, value); + } else { + data.append(key, JSON.stringify(value)); + } +}; + +export const formDataBodySerializer = { + bodySerializer: | Array>>( + body: T, + ): FormData => { + const data = new FormData(); + + Object.entries(body).forEach(([key, value]) => { + if (value === undefined || value === null) { + return; + } + if (Array.isArray(value)) { + value.forEach((v) => serializeFormDataPair(data, key, v)); + } else { + serializeFormDataPair(data, key, value); + } + }); + + return data; + }, +}; + +export const jsonBodySerializer = { + bodySerializer: (body: T): string => + JSON.stringify(body, (_key, value) => (typeof value === 'bigint' ? value.toString() : value)), +}; + +export const urlSearchParamsBodySerializer = { + bodySerializer: | Array>>(body: T): string => { + const data = new URLSearchParams(); + + Object.entries(body).forEach(([key, value]) => { + if (value === undefined || value === null) { + return; + } + if (Array.isArray(value)) { + value.forEach((v) => serializeUrlSearchParamsPair(data, key, v)); + } else { + serializeUrlSearchParamsPair(data, key, value); + } + }); + + return data.toString(); + }, +}; diff --git a/vtex/server/generated/b2b-password-migration-protocol/core/params.gen.ts b/vtex/server/generated/b2b-password-migration-protocol/core/params.gen.ts new file mode 100644 index 00000000..6099cab1 --- /dev/null +++ b/vtex/server/generated/b2b-password-migration-protocol/core/params.gen.ts @@ -0,0 +1,169 @@ +// This file is auto-generated by @hey-api/openapi-ts + +type Slot = 'body' | 'headers' | 'path' | 'query'; + +export type Field = + | { + in: Exclude; + /** + * Field name. This is the name we want the user to see and use. + */ + key: string; + /** + * Field mapped name. This is the name we want to use in the request. + * If omitted, we use the same value as `key`. + */ + map?: string; + } + | { + in: Extract; + /** + * Key isn't required for bodies. + */ + key?: string; + map?: string; + } + | { + /** + * Field name. This is the name we want the user to see and use. + */ + key: string; + /** + * Field mapped name. This is the name we want to use in the request. + * If `in` is omitted, `map` aliases `key` to the transport layer. + */ + map: Slot; + }; + +export interface Fields { + allowExtra?: Partial>; + args?: ReadonlyArray; +} + +export type FieldsConfig = ReadonlyArray; + +const extraPrefixesMap: Record = { + $body_: 'body', + $headers_: 'headers', + $path_: 'path', + $query_: 'query', +}; +const extraPrefixes = Object.entries(extraPrefixesMap); + +type KeyMap = Map< + string, + | { + in: Slot; + map?: string; + } + | { + in?: never; + map: Slot; + } +>; + +const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { + if (!map) { + map = new Map(); + } + + for (const config of fields) { + if ('in' in config) { + if (config.key) { + map.set(config.key, { + in: config.in, + map: config.map, + }); + } + } else if ('key' in config) { + map.set(config.key, { + map: config.map, + }); + } else if (config.args) { + buildKeyMap(config.args, map); + } + } + + return map; +}; + +interface Params { + body: unknown; + headers: Record; + path: Record; + query: Record; +} + +const stripEmptySlots = (params: Params) => { + for (const [slot, value] of Object.entries(params)) { + if (value && typeof value === 'object' && !Object.keys(value).length) { + delete params[slot as Slot]; + } + } +}; + +export const buildClientParams = (args: ReadonlyArray, fields: FieldsConfig) => { + const params: Params = { + body: {}, + headers: {}, + path: {}, + query: {}, + }; + + const map = buildKeyMap(fields); + + let config: FieldsConfig[number] | undefined; + + for (const [index, arg] of args.entries()) { + if (fields[index]) { + config = fields[index]; + } + + if (!config) { + continue; + } + + if ('in' in config) { + if (config.key) { + const field = map.get(config.key)!; + const name = field.map || config.key; + if (field.in) { + (params[field.in] as Record)[name] = arg; + } + } else { + params.body = arg; + } + } else { + for (const [key, value] of Object.entries(arg ?? {})) { + const field = map.get(key); + + if (field) { + if (field.in) { + const name = field.map || key; + (params[field.in] as Record)[name] = value; + } else { + params[field.map] = value; + } + } else { + const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix)); + + if (extra) { + const [prefix, slot] = extra; + (params[slot] as Record)[key.slice(prefix.length)] = value; + } else if ('allowExtra' in config && config.allowExtra) { + for (const [slot, allowed] of Object.entries(config.allowExtra)) { + if (allowed) { + (params[slot as Slot] as Record)[key] = value; + break; + } + } + } + } + } + } + } + + stripEmptySlots(params); + + return params; +}; diff --git a/vtex/server/generated/b2b-password-migration-protocol/core/pathSerializer.gen.ts b/vtex/server/generated/b2b-password-migration-protocol/core/pathSerializer.gen.ts new file mode 100644 index 00000000..994b2848 --- /dev/null +++ b/vtex/server/generated/b2b-password-migration-protocol/core/pathSerializer.gen.ts @@ -0,0 +1,171 @@ +// This file is auto-generated by @hey-api/openapi-ts + +interface SerializeOptions extends SerializePrimitiveOptions, SerializerOptions {} + +interface SerializePrimitiveOptions { + allowReserved?: boolean; + name: string; +} + +export interface SerializerOptions { + /** + * @default true + */ + explode: boolean; + style: T; +} + +export type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited'; +export type ArraySeparatorStyle = ArrayStyle | MatrixStyle; +type MatrixStyle = 'label' | 'matrix' | 'simple'; +export type ObjectStyle = 'form' | 'deepObject'; +type ObjectSeparatorStyle = ObjectStyle | MatrixStyle; + +interface SerializePrimitiveParam extends SerializePrimitiveOptions { + value: string; +} + +export const separatorArrayExplode = (style: ArraySeparatorStyle) => { + switch (style) { + case 'label': + return '.'; + case 'matrix': + return ';'; + case 'simple': + return ','; + default: + return '&'; + } +}; + +export const separatorArrayNoExplode = (style: ArraySeparatorStyle) => { + switch (style) { + case 'form': + return ','; + case 'pipeDelimited': + return '|'; + case 'spaceDelimited': + return '%20'; + default: + return ','; + } +}; + +export const separatorObjectExplode = (style: ObjectSeparatorStyle) => { + switch (style) { + case 'label': + return '.'; + case 'matrix': + return ';'; + case 'simple': + return ','; + default: + return '&'; + } +}; + +export const serializeArrayParam = ({ + allowReserved, + explode, + name, + style, + value, +}: SerializeOptions & { + value: unknown[]; +}) => { + if (!explode) { + const joinedValues = ( + allowReserved ? value : value.map((v) => encodeURIComponent(v as string)) + ).join(separatorArrayNoExplode(style)); + switch (style) { + case 'label': + return `.${joinedValues}`; + case 'matrix': + return `;${name}=${joinedValues}`; + case 'simple': + return joinedValues; + default: + return `${name}=${joinedValues}`; + } + } + + const separator = separatorArrayExplode(style); + const joinedValues = value + .map((v) => { + if (style === 'label' || style === 'simple') { + return allowReserved ? v : encodeURIComponent(v as string); + } + + return serializePrimitiveParam({ + allowReserved, + name, + value: v as string, + }); + }) + .join(separator); + return style === 'label' || style === 'matrix' ? separator + joinedValues : joinedValues; +}; + +export const serializePrimitiveParam = ({ + allowReserved, + name, + value, +}: SerializePrimitiveParam) => { + if (value === undefined || value === null) { + return ''; + } + + if (typeof value === 'object') { + throw new Error( + 'Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.', + ); + } + + return `${name}=${allowReserved ? value : encodeURIComponent(value)}`; +}; + +export const serializeObjectParam = ({ + allowReserved, + explode, + name, + style, + value, + valueOnly, +}: SerializeOptions & { + value: Record | Date; + valueOnly?: boolean; +}) => { + if (value instanceof Date) { + return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`; + } + + if (style !== 'deepObject' && !explode) { + let values: string[] = []; + Object.entries(value).forEach(([key, v]) => { + values = [...values, key, allowReserved ? (v as string) : encodeURIComponent(v as string)]; + }); + const joinedValues = values.join(','); + switch (style) { + case 'form': + return `${name}=${joinedValues}`; + case 'label': + return `.${joinedValues}`; + case 'matrix': + return `;${name}=${joinedValues}`; + default: + return joinedValues; + } + } + + const separator = separatorObjectExplode(style); + const joinedValues = Object.entries(value) + .map(([key, v]) => + serializePrimitiveParam({ + allowReserved, + name: style === 'deepObject' ? `${name}[${key}]` : key, + value: v as string, + }), + ) + .join(separator); + return style === 'label' || style === 'matrix' ? separator + joinedValues : joinedValues; +}; diff --git a/vtex/server/generated/b2b-password-migration-protocol/core/queryKeySerializer.gen.ts b/vtex/server/generated/b2b-password-migration-protocol/core/queryKeySerializer.gen.ts new file mode 100644 index 00000000..5000df60 --- /dev/null +++ b/vtex/server/generated/b2b-password-migration-protocol/core/queryKeySerializer.gen.ts @@ -0,0 +1,117 @@ +// This file is auto-generated by @hey-api/openapi-ts + +/** + * JSON-friendly union that mirrors what Pinia Colada can hash. + */ +export type JsonValue = + | null + | string + | number + | boolean + | JsonValue[] + | { [key: string]: JsonValue }; + +/** + * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes. + */ +export const queryKeyJsonReplacer = (_key: string, value: unknown) => { + if (value === undefined || typeof value === 'function' || typeof value === 'symbol') { + return undefined; + } + if (typeof value === 'bigint') { + return value.toString(); + } + if (value instanceof Date) { + return value.toISOString(); + } + return value; +}; + +/** + * Safely stringifies a value and parses it back into a JsonValue. + */ +export const stringifyToJsonValue = (input: unknown): JsonValue | undefined => { + try { + const json = JSON.stringify(input, queryKeyJsonReplacer); + if (json === undefined) { + return undefined; + } + return JSON.parse(json) as JsonValue; + } catch { + return undefined; + } +}; + +/** + * Detects plain objects (including objects with a null prototype). + */ +const isPlainObject = (value: unknown): value is Record => { + if (value === null || typeof value !== 'object') { + return false; + } + const prototype = Object.getPrototypeOf(value as object); + return prototype === Object.prototype || prototype === null; +}; + +/** + * Turns URLSearchParams into a sorted JSON object for deterministic keys. + */ +const serializeSearchParams = (params: URLSearchParams): JsonValue => { + const entries = Array.from(params.entries()).sort(([a], [b]) => a.localeCompare(b)); + const result: Record = {}; + + for (const [key, value] of entries) { + const existing = result[key]; + if (existing === undefined) { + result[key] = value; + continue; + } + + if (Array.isArray(existing)) { + (existing as string[]).push(value); + } else { + result[key] = [existing, value]; + } + } + + return result; +}; + +/** + * Normalizes any accepted value into a JSON-friendly shape for query keys. + */ +export const serializeQueryKeyValue = (value: unknown): JsonValue | undefined => { + if (value === null) { + return null; + } + + if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { + return value; + } + + if (value === undefined || typeof value === 'function' || typeof value === 'symbol') { + return undefined; + } + + if (typeof value === 'bigint') { + return value.toString(); + } + + if (value instanceof Date) { + return value.toISOString(); + } + + if (Array.isArray(value)) { + return stringifyToJsonValue(value); + } + + if (typeof URLSearchParams !== 'undefined' && value instanceof URLSearchParams) { + return serializeSearchParams(value); + } + + if (isPlainObject(value)) { + return stringifyToJsonValue(value); + } + + return undefined; +}; diff --git a/vtex/server/generated/b2b-password-migration-protocol/core/serverSentEvents.gen.ts b/vtex/server/generated/b2b-password-migration-protocol/core/serverSentEvents.gen.ts new file mode 100644 index 00000000..6aa6cf02 --- /dev/null +++ b/vtex/server/generated/b2b-password-migration-protocol/core/serverSentEvents.gen.ts @@ -0,0 +1,243 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Config } from './types.gen'; + +export type ServerSentEventsOptions = Omit & + Pick & { + /** + * Fetch API implementation. You can use this option to provide a custom + * fetch instance. + * + * @default globalThis.fetch + */ + fetch?: typeof fetch; + /** + * Implementing clients can call request interceptors inside this hook. + */ + onRequest?: (url: string, init: RequestInit) => Promise; + /** + * Callback invoked when a network or parsing error occurs during streaming. + * + * This option applies only if the endpoint returns a stream of events. + * + * @param error The error that occurred. + */ + onSseError?: (error: unknown) => void; + /** + * Callback invoked when an event is streamed from the server. + * + * This option applies only if the endpoint returns a stream of events. + * + * @param event Event streamed from the server. + * @returns Nothing (void). + */ + onSseEvent?: (event: StreamEvent) => void; + serializedBody?: RequestInit['body']; + /** + * Default retry delay in milliseconds. + * + * This option applies only if the endpoint returns a stream of events. + * + * @default 3000 + */ + sseDefaultRetryDelay?: number; + /** + * Maximum number of retry attempts before giving up. + */ + sseMaxRetryAttempts?: number; + /** + * Maximum retry delay in milliseconds. + * + * Applies only when exponential backoff is used. + * + * This option applies only if the endpoint returns a stream of events. + * + * @default 30000 + */ + sseMaxRetryDelay?: number; + /** + * Optional sleep function for retry backoff. + * + * Defaults to using `setTimeout`. + */ + sseSleepFn?: (ms: number) => Promise; + url: string; + }; + +export interface StreamEvent { + data: TData; + event?: string; + id?: string; + retry?: number; +} + +export type ServerSentEventsResult = { + stream: AsyncGenerator< + TData extends Record ? TData[keyof TData] : TData, + TReturn, + TNext + >; +}; + +export const createSseClient = ({ + onRequest, + onSseError, + onSseEvent, + responseTransformer, + responseValidator, + sseDefaultRetryDelay, + sseMaxRetryAttempts, + sseMaxRetryDelay, + sseSleepFn, + url, + ...options +}: ServerSentEventsOptions): ServerSentEventsResult => { + let lastEventId: string | undefined; + + const sleep = sseSleepFn ?? ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms))); + + const createStream = async function* () { + let retryDelay: number = sseDefaultRetryDelay ?? 3000; + let attempt = 0; + const signal = options.signal ?? new AbortController().signal; + + while (true) { + if (signal.aborted) break; + + attempt++; + + const headers = + options.headers instanceof Headers + ? options.headers + : new Headers(options.headers as Record | undefined); + + if (lastEventId !== undefined) { + headers.set('Last-Event-ID', lastEventId); + } + + try { + const requestInit: RequestInit = { + redirect: 'follow', + ...options, + body: options.serializedBody, + headers, + signal, + }; + let request = new Request(url, requestInit); + if (onRequest) { + request = await onRequest(url, requestInit); + } + // fetch must be assigned here, otherwise it would throw the error: + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation + const _fetch = options.fetch ?? globalThis.fetch; + const response = await _fetch(request); + + if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`); + + if (!response.body) throw new Error('No body in SSE response'); + + const reader = response.body.pipeThrough(new TextDecoderStream()).getReader(); + + let buffer = ''; + + const abortHandler = () => { + try { + reader.cancel(); + } catch { + // noop + } + }; + + signal.addEventListener('abort', abortHandler); + + try { + while (true) { + const { done, value } = await reader.read(); + if (done) break; + buffer += value; + // Normalize line endings: CRLF -> LF, then CR -> LF + buffer = buffer.replace(/\r\n/g, '\n').replace(/\r/g, '\n'); + + const chunks = buffer.split('\n\n'); + buffer = chunks.pop() ?? ''; + + for (const chunk of chunks) { + const lines = chunk.split('\n'); + const dataLines: Array = []; + let eventName: string | undefined; + + for (const line of lines) { + if (line.startsWith('data:')) { + dataLines.push(line.replace(/^data:\s*/, '')); + } else if (line.startsWith('event:')) { + eventName = line.replace(/^event:\s*/, ''); + } else if (line.startsWith('id:')) { + lastEventId = line.replace(/^id:\s*/, ''); + } else if (line.startsWith('retry:')) { + const parsed = Number.parseInt(line.replace(/^retry:\s*/, ''), 10); + if (!Number.isNaN(parsed)) { + retryDelay = parsed; + } + } + } + + let data: unknown; + let parsedJson = false; + + if (dataLines.length) { + const rawData = dataLines.join('\n'); + try { + data = JSON.parse(rawData); + parsedJson = true; + } catch { + data = rawData; + } + } + + if (parsedJson) { + if (responseValidator) { + await responseValidator(data); + } + + if (responseTransformer) { + data = await responseTransformer(data); + } + } + + onSseEvent?.({ + data, + event: eventName, + id: lastEventId, + retry: retryDelay, + }); + + if (dataLines.length) { + yield data as any; + } + } + } + } finally { + signal.removeEventListener('abort', abortHandler); + reader.releaseLock(); + } + + break; // exit loop on normal completion + } catch (error) { + // connection failed or aborted; retry after delay + onSseError?.(error); + + if (sseMaxRetryAttempts !== undefined && attempt >= sseMaxRetryAttempts) { + break; // stop after firing error + } + + // exponential backoff: double retry each attempt, cap at 30s + const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 30000); + await sleep(backoff); + } + } + }; + + const stream = createStream(); + + return { stream }; +}; diff --git a/vtex/server/generated/b2b-password-migration-protocol/core/types.gen.ts b/vtex/server/generated/b2b-password-migration-protocol/core/types.gen.ts new file mode 100644 index 00000000..97463257 --- /dev/null +++ b/vtex/server/generated/b2b-password-migration-protocol/core/types.gen.ts @@ -0,0 +1,104 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Auth, AuthToken } from './auth.gen'; +import type { BodySerializer, QuerySerializer, QuerySerializerOptions } from './bodySerializer.gen'; + +export type HttpMethod = + | 'connect' + | 'delete' + | 'get' + | 'head' + | 'options' + | 'patch' + | 'post' + | 'put' + | 'trace'; + +export type Client< + RequestFn = never, + Config = unknown, + MethodFn = never, + BuildUrlFn = never, + SseFn = never, +> = { + /** + * Returns the final request URL. + */ + buildUrl: BuildUrlFn; + getConfig: () => Config; + request: RequestFn; + setConfig: (config: Config) => Config; +} & { + [K in HttpMethod]: MethodFn; +} & ([SseFn] extends [never] ? { sse?: never } : { sse: { [K in HttpMethod]: SseFn } }); + +export interface Config { + /** + * Auth token or a function returning auth token. The resolved value will be + * added to the request payload as defined by its `security` array. + */ + auth?: ((auth: Auth) => Promise | AuthToken) | AuthToken; + /** + * A function for serializing request body parameter. By default, + * {@link JSON.stringify()} will be used. + */ + bodySerializer?: BodySerializer | null; + /** + * An object containing any HTTP headers that you want to pre-populate your + * `Headers` object with. + * + * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more} + */ + headers?: + | RequestInit['headers'] + | Record< + string, + string | number | boolean | (string | number | boolean)[] | null | undefined | unknown + >; + /** + * The request method. + * + * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more} + */ + method?: Uppercase; + /** + * A function for serializing request query parameters. By default, arrays + * will be exploded in form style, objects will be exploded in deepObject + * style, and reserved characters are percent-encoded. + * + * This method will have no effect if the native `paramsSerializer()` Axios + * API function is used. + * + * {@link https://swagger.io/docs/specification/serialization/#query View examples} + */ + querySerializer?: QuerySerializer | QuerySerializerOptions; + /** + * A function validating request data. This is useful if you want to ensure + * the request conforms to the desired shape, so it can be safely sent to + * the server. + */ + requestValidator?: (data: unknown) => Promise; + /** + * A function transforming response data before it's returned. This is useful + * for post-processing data, e.g. converting ISO strings into Date objects. + */ + responseTransformer?: (data: unknown) => Promise; + /** + * A function validating response data. This is useful if you want to ensure + * the response conforms to the desired shape, so it can be safely passed to + * the transformers and returned to the user. + */ + responseValidator?: (data: unknown) => Promise; +} + +type IsExactlyNeverOrNeverUndefined = [T] extends [never] + ? true + : [T] extends [never | undefined] + ? [undefined] extends [T] + ? false + : true + : false; + +export type OmitNever> = { + [K in keyof T as IsExactlyNeverOrNeverUndefined extends true ? never : K]: T[K]; +}; diff --git a/vtex/server/generated/b2b-password-migration-protocol/core/utils.gen.ts b/vtex/server/generated/b2b-password-migration-protocol/core/utils.gen.ts new file mode 100644 index 00000000..e7ddbe35 --- /dev/null +++ b/vtex/server/generated/b2b-password-migration-protocol/core/utils.gen.ts @@ -0,0 +1,140 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; +import { + type ArraySeparatorStyle, + serializeArrayParam, + serializeObjectParam, + serializePrimitiveParam, +} from './pathSerializer.gen'; + +export interface PathSerializer { + path: Record; + url: string; +} + +export const PATH_PARAM_RE = /\{[^{}]+\}/g; + +export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { + let url = _url; + const matches = _url.match(PATH_PARAM_RE); + if (matches) { + for (const match of matches) { + let explode = false; + let name = match.substring(1, match.length - 1); + let style: ArraySeparatorStyle = 'simple'; + + if (name.endsWith('*')) { + explode = true; + name = name.substring(0, name.length - 1); + } + + if (name.startsWith('.')) { + name = name.substring(1); + style = 'label'; + } else if (name.startsWith(';')) { + name = name.substring(1); + style = 'matrix'; + } + + const value = path[name]; + + if (value === undefined || value === null) { + continue; + } + + if (Array.isArray(value)) { + url = url.replace(match, serializeArrayParam({ explode, name, style, value })); + continue; + } + + if (typeof value === 'object') { + url = url.replace( + match, + serializeObjectParam({ + explode, + name, + style, + value: value as Record, + valueOnly: true, + }), + ); + continue; + } + + if (style === 'matrix') { + url = url.replace( + match, + `;${serializePrimitiveParam({ + name, + value: value as string, + })}`, + ); + continue; + } + + const replaceValue = encodeURIComponent( + style === 'label' ? `.${value as string}` : (value as string), + ); + url = url.replace(match, replaceValue); + } + } + return url; +}; + +export const getUrl = ({ + baseUrl, + path, + query, + querySerializer, + url: _url, +}: { + baseUrl?: string; + path?: Record; + query?: Record; + querySerializer: QuerySerializer; + url: string; +}) => { + const pathUrl = _url.startsWith('/') ? _url : `/${_url}`; + let url = (baseUrl ?? '') + pathUrl; + if (path) { + url = defaultPathSerializer({ path, url }); + } + let search = query ? querySerializer(query) : ''; + if (search.startsWith('?')) { + search = search.substring(1); + } + if (search) { + url += `?${search}`; + } + return url; +}; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // not all clients implement a serializedBody property (i.e. client-axios) + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/vtex/server/generated/b2b-password-migration-protocol/index.ts b/vtex/server/generated/b2b-password-migration-protocol/index.ts new file mode 100644 index 00000000..899149c7 --- /dev/null +++ b/vtex/server/generated/b2b-password-migration-protocol/index.ts @@ -0,0 +1,4 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export { type Options, registerClient, validateLegacyCredentials } from './sdk.gen'; +export type { Accept, ClientOptions, RegisterClientData, RegisterClientErrors, RegisterClientResponse, RegisterClientResponses, ValidateLegacyCredentialsData, ValidateLegacyCredentialsErrors, ValidateLegacyCredentialsResponses } from './types.gen'; diff --git a/vtex/server/generated/b2b-password-migration-protocol/sdk.gen.ts b/vtex/server/generated/b2b-password-migration-protocol/sdk.gen.ts new file mode 100644 index 00000000..16fb8c28 --- /dev/null +++ b/vtex/server/generated/b2b-password-migration-protocol/sdk.gen.ts @@ -0,0 +1,125 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Client, Options as Options2, TDataShape } from './client'; +import { client } from './client.gen'; +import type { RegisterClientData, RegisterClientErrors, RegisterClientResponses, ValidateLegacyCredentialsData, ValidateLegacyCredentialsErrors, ValidateLegacyCredentialsResponses } from './types.gen'; + +export type Options = Options2 & { + /** + * You can provide a client instance returned by `createClient()` instead of + * individual options. This might be also useful if you want to implement a + * custom client. + */ + client?: Client; + /** + * You can pass arbitrary values through the `meta` object. This can be + * used to access values that aren't defined as part of the SDK function. + */ + meta?: Record; +}; + +/** + * Register client + * + * Registers VTEX as a client in your middleware and generates the shared credentials used for HMAC request signing. VTEX calls this endpoint before sending any authentication requests. + * + * For more information, see the [B2B password migration guide](https://developers.vtex.com/docs/guides/b2b-password-migration). + * + * Your middleware must: + * 1. Generate a unique `ClientId` for the store. + * 2. Generate a high-entropy `Secret` (recommended: 32+ random bytes / 256-bit, encoded as Base64). + * 3. Store the mapping between the store name, ClientId, and Secret. + * 4. Return the generated credentials to VTEX. + * + * > ℹ️ This request is made from VTEX to your authentication middleware during the initial setup. + * + * ## Security requirements + * + * - The `Secret` should be a high-entropy value (recommended: 32+ random bytes / 256-bit, encoded as Base64). + * - Store the `Secret` securely and treat it as a sensitive credential. + * - Never log the `Secret` or expose it in error messages. + * - Do not reuse secrets across different environments (staging vs. production). + * + * ## Permissions + * + * Check with your service provider to know what permissions are needed. + */ +export const registerClient = (options: Options) => (options.client ?? client).post({ url: '/register', ...options }); + +/** + * Validate legacy credentials + * + * Validates a user's legacy credentials against your external authentication system. This endpoint is called by VTEX when a user with the `isLegacyPassword` flag attempts to log in for the first time. + * + * For more information, see the [B2B password migration guide](https://developers.vtex.com/docs/guides/b2b-password-migration). + * + * ⚠️ The request to your middleware will always be made from one of the VTEX IPs listed at [http://ips.vtex.com](http://ips.vtex.com). Although VTEX cannot enforce this, we strongly recommend that your middleware checks the IP origin. If the IP is not from VTEX, your middleware should not respond. + * + * > ℹ️ This request is made from VTEX to your authentication middleware. + * + * ## Endpoint-specific requirements + * + * - The endpoint path must end with `/authentication`. + * - Must validate HMAC-SHA256 signatures to authenticate requests from VTEX. + * - Must check that requests originate from VTEX IP addresses. + * + * ## Middleware verification steps + * + * Your middleware must perform the following steps in order: + * + * 1. Validate that all required headers are present. + * 2. Validate timestamp within ±300 seconds (recommended). + * 3. Validate that the nonce has not been seen before for this `ClientId` within the clock skew window. + * 4. Reconstruct the canonical string from the incoming request. + * 5. Compute the expected HMAC-SHA256 signature and compare using constant-time comparison. + * 6. Only then proceed to validate credentials against the legacy system. + * + * ## HMAC signature validation + * + * VTEX and your middleware must sign the exact same canonical string. Your middleware must reconstruct it from the incoming request. + * + * **Canonical string format (with `\n` separators, UTF-8 encoded):** + * + * ``` + * {HTTP_METHOD}\n + * {PATH}\n + * {X-VTEX-Client-Id}\n + * {X-VTEX-Timestamp}\n + * {X-VTEX-Nonce}\n + * {SHA256_OF_BODY} + * ``` + * + * Where: + * - `HTTP_METHOD` is uppercase (e.g., `POST`). + * - `PATH` is `/authentication` and any provided query strings (no scheme or host). + * - `SHA256_OF_BODY` is the base64-encoded SHA-256 digest of the raw request body bytes. Do not parse or re-serialize the JSON. + * + * **Signature computation:** + * + * ``` + * signature = HMAC-SHA256(UTF8(canonicalString), secret) + * ``` + * + * **Authorization header format:** + * + * ``` + * Authorization: HMAC-SHA256 SignedHeaders=X-VTEX-Client-Id;X-VTEX-Timestamp;X-VTEX-Nonce;X-VTEX-Content-SHA256&Signature={{signature}} + * ``` + * + * ## Response requirements + * + * Your middleware must return **only** the following HTTP status codes: + * + * - `200 OK`: Credentials are valid; user is authorized. + * - `401 Unauthorized`: Credentials are invalid (user not found or wrong password). + * - `403 Forbidden`: Request is not authenticated (invalid or missing HMAC). + * + * Any other HTTP status code is treated by VTEX as a technical error. + * + * ⚠️ **Important for security:** "User not found" and "wrong password" scenarios must both return `401`, indistinguishably. This prevents user enumeration. Don't include response body content that reveals credential validity, user existence, or internal errors. VTEX ignores response bodies entirely. + * + * ## Permissions + * + * Check with your service provider to know what permissions are needed. + */ +export const validateLegacyCredentials = (options: Options) => (options.client ?? client).post({ url: '/authentication', ...options }); diff --git a/vtex/server/generated/b2b-password-migration-protocol/types.gen.ts b/vtex/server/generated/b2b-password-migration-protocol/types.gen.ts new file mode 100644 index 00000000..a6f79fcf --- /dev/null +++ b/vtex/server/generated/b2b-password-migration-protocol/types.gen.ts @@ -0,0 +1,147 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type ClientOptions = { + baseUrl: 'https://{middlewareEndpoint}' | (string & {}); +}; + +/** + * HTTP Client Negotiation Accept Header. Indicates the types of responses the client can understand. + */ +export type Accept = string; + +export type RegisterClientData = { + /** + * Store information for client registration. + */ + body: { + /** + * Name of the VTEX store registering as a client. + */ + Store: string; + }; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation Accept Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path?: never; + query?: never; + url: '/register'; +}; + +export type RegisterClientErrors = { + /** + * Bad Request + * + * Invalid request format or missing required fields. + */ + 400: unknown; + /** + * Internal Server Error + * + * Error generating credentials on the middleware side. + */ + 500: unknown; +}; + +export type RegisterClientResponses = { + /** + * OK + * + * Client registered successfully and returns the generated credentials. + */ + 200: { + /** + * Echo of the store name from the request. + */ + Store?: string; + /** + * Generated client identifier. This will be sent in the `X-VTEX-Client-Id` header in subsequent requests. + */ + ClientId?: string; + /** + * Generated shared secret (Base64-encoded). Used by VTEX to sign requests via HMAC-SHA256. + */ + Secret?: string; + }; +}; + +export type RegisterClientResponse = RegisterClientResponses[keyof RegisterClientResponses]; + +export type ValidateLegacyCredentialsData = { + /** + * Legacy user credentials to validate. + */ + body: { + /** + * The user's username or login identifier from the legacy system. + */ + username: string; + /** + * The user's password in plain text. Your middleware is responsible for secure handling and validation. + */ + password: string; + }; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation Accept Header. Indicates the types of responses the client can understand. + */ + Accept: string; + /** + * Client identifier agreed upon during registration. + */ + 'X-VTEX-Client-Id': string; + /** + * Request timestamp in RFC 1123 format. Must be within an acceptable clock skew window (recommended: ±300 seconds). + */ + 'X-VTEX-Timestamp': string; + /** + * Unique random string for this request. Must be unique per client within the clock skew window. Your middleware must enforce nonce uniqueness to prevent replay attacks. + */ + 'X-VTEX-Nonce': string; + /** + * Base64-encoded SHA-256 hash of the request body. + */ + 'X-VTEX-Content-SHA256': string; + /** + * HMAC-SHA256 signature of the canonical string. Format: `HMAC-SHA256 SignedHeaders=X-VTEX-Client-Id;X-VTEX-Timestamp;X-VTEX-Nonce;X-VTEX-Content-SHA256&Signature={{signature}}` + */ + Authorization: string; + }; + path?: never; + query?: never; + url: '/authentication'; +}; + +export type ValidateLegacyCredentialsErrors = { + /** + * Unauthorized + * + * Credentials are invalid as user not found or wrong password. + */ + 401: unknown; + /** + * Forbidden + * + * Request is not authenticated due to invalid or missing HMAC. + */ + 403: unknown; +}; + +export type ValidateLegacyCredentialsResponses = { + /** + * OK + * + * Credentials are valid and user is authorized. + */ + 200: unknown; +}; diff --git a/vtex/server/generated/b2b-password-migration-protocol/zod.gen.ts b/vtex/server/generated/b2b-password-migration-protocol/zod.gen.ts new file mode 100644 index 00000000..0da14912 --- /dev/null +++ b/vtex/server/generated/b2b-password-migration-protocol/zod.gen.ts @@ -0,0 +1,38 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import * as z from 'zod'; + +/** + * HTTP Client Negotiation Accept Header. Indicates the types of responses the client can understand. + */ +export const zAccept = z.string().default('application/json'); + +export const zRegisterClientData = z.object({ + body: z.object({ + Store: z.string() + }), + path: z.optional(z.never()), + query: z.optional(z.never()), + headers: z.object({ + 'Content-Type': z.string().default('application/json; charset=utf-8'), + Accept: z.string().default('application/json') + }) +}); + +export const zValidateLegacyCredentialsData = z.object({ + body: z.object({ + username: z.string(), + password: z.string() + }), + path: z.optional(z.never()), + query: z.optional(z.never()), + headers: z.object({ + 'Content-Type': z.string().default('application/json; charset=utf-8'), + Accept: z.string().default('application/json'), + 'X-VTEX-Client-Id': z.string(), + 'X-VTEX-Timestamp': z.string(), + 'X-VTEX-Nonce': z.string(), + 'X-VTEX-Content-SHA256': z.string(), + Authorization: z.string() + }) +}); diff --git a/vtex/server/generated/bulk-pricing/client.gen.ts b/vtex/server/generated/bulk-pricing/client.gen.ts new file mode 100644 index 00000000..cab3c701 --- /dev/null +++ b/vtex/server/generated/bulk-pricing/client.gen.ts @@ -0,0 +1,16 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { type ClientOptions, type Config, createClient, createConfig } from './client'; +import type { ClientOptions as ClientOptions2 } from './types.gen'; + +/** + * The `createClientConfig()` function will be called on client initialization + * and the returned object will become the client's initial configuration. + * + * You may want to initialize your client this way instead of calling + * `setConfig()`. This is useful for example if you're using Next.js + * to ensure your client always has the correct values. + */ +export type CreateClientConfig = (override?: Config) => Config & T>; + +export const client = createClient(createConfig()); diff --git a/vtex/server/generated/bulk-pricing/client/client.gen.ts b/vtex/server/generated/bulk-pricing/client/client.gen.ts new file mode 100644 index 00000000..d2e55a14 --- /dev/null +++ b/vtex/server/generated/bulk-pricing/client/client.gen.ts @@ -0,0 +1,288 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { createSseClient } from '../core/serverSentEvents.gen'; +import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; +import type { Client, Config, RequestOptions, ResolvedRequestOptions } from './types.gen'; +import { + buildUrl, + createConfig, + createInterceptors, + getParseAs, + mergeConfigs, + mergeHeaders, + setAuthParams, +} from './utils.gen'; + +type ReqInit = Omit & { + body?: any; + headers: ReturnType; +}; + +export const createClient = (config: Config = {}): Client => { + let _config = mergeConfigs(createConfig(), config); + + const getConfig = (): Config => ({ ..._config }); + + const setConfig = (config: Config): Config => { + _config = mergeConfigs(_config, config); + return getConfig(); + }; + + const interceptors = createInterceptors(); + + const beforeRequest = async (options: RequestOptions) => { + const opts = { + ..._config, + ...options, + fetch: options.fetch ?? _config.fetch ?? globalThis.fetch, + headers: mergeHeaders(_config.headers, options.headers), + serializedBody: undefined, + }; + + if (opts.security) { + await setAuthParams({ + ...opts, + security: opts.security, + }); + } + + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + + if (opts.body !== undefined && opts.bodySerializer) { + opts.serializedBody = opts.bodySerializer(opts.body); + } + + // remove Content-Type header if body is empty to avoid sending invalid requests + if (opts.body === undefined || opts.serializedBody === '') { + opts.headers.delete('Content-Type'); + } + + const url = buildUrl(opts); + + return { opts, url }; + }; + + const request: Client['request'] = async (options) => { + // @ts-expect-error + const { opts, url } = await beforeRequest(options); + const requestInit: ReqInit = { + redirect: 'follow', + ...opts, + body: getValidRequestBody(opts), + }; + + let request = new Request(url, requestInit); + + for (const fn of interceptors.request.fns) { + if (fn) { + request = await fn(request, opts); + } + } + + // fetch must be assigned here, otherwise it would throw the error: + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation + const _fetch = opts.fetch!; + let response: Response; + + try { + response = await _fetch(request); + } catch (error) { + // Handle fetch exceptions (AbortError, network errors, etc.) + let finalError = error; + + for (const fn of interceptors.error.fns) { + if (fn) { + finalError = (await fn(error, undefined as any, request, opts)) as unknown; + } + } + + finalError = finalError || ({} as unknown); + + if (opts.throwOnError) { + throw finalError; + } + + // Return error response + return opts.responseStyle === 'data' + ? undefined + : { + error: finalError, + request, + response: undefined as any, + }; + } + + for (const fn of interceptors.response.fns) { + if (fn) { + response = await fn(response, request, opts); + } + } + + const result = { + request, + response, + }; + + if (response.ok) { + const parseAs = + (opts.parseAs === 'auto' + ? getParseAs(response.headers.get('Content-Type')) + : opts.parseAs) ?? 'json'; + + if (response.status === 204 || response.headers.get('Content-Length') === '0') { + let emptyData: any; + switch (parseAs) { + case 'arrayBuffer': + case 'blob': + case 'text': + emptyData = await response[parseAs](); + break; + case 'formData': + emptyData = new FormData(); + break; + case 'stream': + emptyData = response.body; + break; + case 'json': + default: + emptyData = {}; + break; + } + return opts.responseStyle === 'data' + ? emptyData + : { + data: emptyData, + ...result, + }; + } + + let data: any; + switch (parseAs) { + case 'arrayBuffer': + case 'blob': + case 'formData': + case 'text': + data = await response[parseAs](); + break; + case 'json': { + // Some servers return 200 with no Content-Length and empty body. + // response.json() would throw; read as text and parse if non-empty. + const text = await response.text(); + data = text ? JSON.parse(text) : {}; + break; + } + case 'stream': + return opts.responseStyle === 'data' + ? response.body + : { + data: response.body, + ...result, + }; + } + + if (parseAs === 'json') { + if (opts.responseValidator) { + await opts.responseValidator(data); + } + + if (opts.responseTransformer) { + data = await opts.responseTransformer(data); + } + } + + return opts.responseStyle === 'data' + ? data + : { + data, + ...result, + }; + } + + const textError = await response.text(); + let jsonError: unknown; + + try { + jsonError = JSON.parse(textError); + } catch { + // noop + } + + const error = jsonError ?? textError; + let finalError = error; + + for (const fn of interceptors.error.fns) { + if (fn) { + finalError = (await fn(error, response, request, opts)) as string; + } + } + + finalError = finalError || ({} as string); + + if (opts.throwOnError) { + throw finalError; + } + + // TODO: we probably want to return error and improve types + return opts.responseStyle === 'data' + ? undefined + : { + error: finalError, + ...result, + }; + }; + + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => + request({ ...options, method }); + + const makeSseFn = (method: Uppercase) => async (options: RequestOptions) => { + const { opts, url } = await beforeRequest(options); + return createSseClient({ + ...opts, + body: opts.body as BodyInit | null | undefined, + headers: opts.headers as unknown as Record, + method, + onRequest: async (url, init) => { + let request = new Request(url, init); + for (const fn of interceptors.request.fns) { + if (fn) { + request = await fn(request, opts); + } + } + return request; + }, + serializedBody: getValidRequestBody(opts) as BodyInit | null | undefined, + url, + }); + }; + + return { + buildUrl, + connect: makeMethodFn('CONNECT'), + delete: makeMethodFn('DELETE'), + get: makeMethodFn('GET'), + getConfig, + head: makeMethodFn('HEAD'), + interceptors, + options: makeMethodFn('OPTIONS'), + patch: makeMethodFn('PATCH'), + post: makeMethodFn('POST'), + put: makeMethodFn('PUT'), + request, + setConfig, + sse: { + connect: makeSseFn('CONNECT'), + delete: makeSseFn('DELETE'), + get: makeSseFn('GET'), + head: makeSseFn('HEAD'), + options: makeSseFn('OPTIONS'), + patch: makeSseFn('PATCH'), + post: makeSseFn('POST'), + put: makeSseFn('PUT'), + trace: makeSseFn('TRACE'), + }, + trace: makeMethodFn('TRACE'), + } as Client; +}; diff --git a/vtex/server/generated/bulk-pricing/client/index.ts b/vtex/server/generated/bulk-pricing/client/index.ts new file mode 100644 index 00000000..b295edec --- /dev/null +++ b/vtex/server/generated/bulk-pricing/client/index.ts @@ -0,0 +1,25 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type { Auth } from '../core/auth.gen'; +export type { QuerySerializerOptions } from '../core/bodySerializer.gen'; +export { + formDataBodySerializer, + jsonBodySerializer, + urlSearchParamsBodySerializer, +} from '../core/bodySerializer.gen'; +export { buildClientParams } from '../core/params.gen'; +export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen'; +export { createClient } from './client.gen'; +export type { + Client, + ClientOptions, + Config, + CreateClientConfig, + Options, + RequestOptions, + RequestResult, + ResolvedRequestOptions, + ResponseStyle, + TDataShape, +} from './types.gen'; +export { createConfig, mergeHeaders } from './utils.gen'; diff --git a/vtex/server/generated/bulk-pricing/client/types.gen.ts b/vtex/server/generated/bulk-pricing/client/types.gen.ts new file mode 100644 index 00000000..cb6d0d54 --- /dev/null +++ b/vtex/server/generated/bulk-pricing/client/types.gen.ts @@ -0,0 +1,213 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Auth } from '../core/auth.gen'; +import type { + ServerSentEventsOptions, + ServerSentEventsResult, +} from '../core/serverSentEvents.gen'; +import type { Client as CoreClient, Config as CoreConfig } from '../core/types.gen'; +import type { Middleware } from './utils.gen'; + +export type ResponseStyle = 'data' | 'fields'; + +export interface Config + extends Omit, CoreConfig { + /** + * Base URL for all requests made by this client. + */ + baseUrl?: T['baseUrl']; + /** + * Fetch API implementation. You can use this option to provide a custom + * fetch instance. + * + * @default globalThis.fetch + */ + fetch?: typeof fetch; + /** + * Please don't use the Fetch client for Next.js applications. The `next` + * options won't have any effect. + * + * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead. + */ + next?: never; + /** + * Return the response data parsed in a specified format. By default, `auto` + * will infer the appropriate method from the `Content-Type` response header. + * You can override this behavior with any of the {@link Body} methods. + * Select `stream` if you don't want to parse response data at all. + * + * @default 'auto' + */ + parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text'; + /** + * Should we return only data or multiple fields (data, error, response, etc.)? + * + * @default 'fields' + */ + responseStyle?: ResponseStyle; + /** + * Throw an error instead of returning it in the response? + * + * @default false + */ + throwOnError?: T['throwOnError']; +} + +export interface RequestOptions< + TData = unknown, + TResponseStyle extends ResponseStyle = 'fields', + ThrowOnError extends boolean = boolean, + Url extends string = string, +> + extends + Config<{ + responseStyle: TResponseStyle; + throwOnError: ThrowOnError; + }>, + Pick< + ServerSentEventsOptions, + | 'onSseError' + | 'onSseEvent' + | 'sseDefaultRetryDelay' + | 'sseMaxRetryAttempts' + | 'sseMaxRetryDelay' + > { + /** + * Any body that you want to add to your request. + * + * {@link https://developer.mozilla.org/docs/Web/API/fetch#body} + */ + body?: unknown; + path?: Record; + query?: Record; + /** + * Security mechanism(s) to use for the request. + */ + security?: ReadonlyArray; + url: Url; +} + +export interface ResolvedRequestOptions< + TResponseStyle extends ResponseStyle = 'fields', + ThrowOnError extends boolean = boolean, + Url extends string = string, +> extends RequestOptions { + serializedBody?: string; +} + +export type RequestResult< + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = boolean, + TResponseStyle extends ResponseStyle = 'fields', +> = ThrowOnError extends true + ? Promise< + TResponseStyle extends 'data' + ? TData extends Record + ? TData[keyof TData] + : TData + : { + data: TData extends Record ? TData[keyof TData] : TData; + request: Request; + response: Response; + } + > + : Promise< + TResponseStyle extends 'data' + ? (TData extends Record ? TData[keyof TData] : TData) | undefined + : ( + | { + data: TData extends Record ? TData[keyof TData] : TData; + error: undefined; + } + | { + data: undefined; + error: TError extends Record ? TError[keyof TError] : TError; + } + ) & { + request: Request; + response: Response; + } + >; + +export interface ClientOptions { + baseUrl?: string; + responseStyle?: ResponseStyle; + throwOnError?: boolean; +} + +type MethodFn = < + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = false, + TResponseStyle extends ResponseStyle = 'fields', +>( + options: Omit, 'method'>, +) => RequestResult; + +type SseFn = < + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = false, + TResponseStyle extends ResponseStyle = 'fields', +>( + options: Omit, 'method'>, +) => Promise>; + +type RequestFn = < + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = false, + TResponseStyle extends ResponseStyle = 'fields', +>( + options: Omit, 'method'> & + Pick>, 'method'>, +) => RequestResult; + +type BuildUrlFn = < + TData extends { + body?: unknown; + path?: Record; + query?: Record; + url: string; + }, +>( + options: TData & Options, +) => string; + +export type Client = CoreClient & { + interceptors: Middleware; +}; + +/** + * The `createClientConfig()` function will be called on client initialization + * and the returned object will become the client's initial configuration. + * + * You may want to initialize your client this way instead of calling + * `setConfig()`. This is useful for example if you're using Next.js + * to ensure your client always has the correct values. + */ +export type CreateClientConfig = ( + override?: Config, +) => Config & T>; + +export interface TDataShape { + body?: unknown; + headers?: unknown; + path?: unknown; + query?: unknown; + url: string; +} + +type OmitKeys = Pick>; + +export type Options< + TData extends TDataShape = TDataShape, + ThrowOnError extends boolean = boolean, + TResponse = unknown, + TResponseStyle extends ResponseStyle = 'fields', +> = OmitKeys< + RequestOptions, + 'body' | 'path' | 'query' | 'url' +> & + ([TData] extends [never] ? unknown : Omit); diff --git a/vtex/server/generated/bulk-pricing/client/utils.gen.ts b/vtex/server/generated/bulk-pricing/client/utils.gen.ts new file mode 100644 index 00000000..b4bd2435 --- /dev/null +++ b/vtex/server/generated/bulk-pricing/client/utils.gen.ts @@ -0,0 +1,316 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { getAuthToken } from '../core/auth.gen'; +import type { QuerySerializerOptions } from '../core/bodySerializer.gen'; +import { jsonBodySerializer } from '../core/bodySerializer.gen'; +import { + serializeArrayParam, + serializeObjectParam, + serializePrimitiveParam, +} from '../core/pathSerializer.gen'; +import { getUrl } from '../core/utils.gen'; +import type { Client, ClientOptions, Config, RequestOptions } from './types.gen'; + +export const createQuerySerializer = ({ + parameters = {}, + ...args +}: QuerySerializerOptions = {}) => { + const querySerializer = (queryParams: T) => { + const search: string[] = []; + if (queryParams && typeof queryParams === 'object') { + for (const name in queryParams) { + const value = queryParams[name]; + + if (value === undefined || value === null) { + continue; + } + + const options = parameters[name] || args; + + if (Array.isArray(value)) { + const serializedArray = serializeArrayParam({ + allowReserved: options.allowReserved, + explode: true, + name, + style: 'form', + value, + ...options.array, + }); + if (serializedArray) search.push(serializedArray); + } else if (typeof value === 'object') { + const serializedObject = serializeObjectParam({ + allowReserved: options.allowReserved, + explode: true, + name, + style: 'deepObject', + value: value as Record, + ...options.object, + }); + if (serializedObject) search.push(serializedObject); + } else { + const serializedPrimitive = serializePrimitiveParam({ + allowReserved: options.allowReserved, + name, + value: value as string, + }); + if (serializedPrimitive) search.push(serializedPrimitive); + } + } + } + return search.join('&'); + }; + return querySerializer; +}; + +/** + * Infers parseAs value from provided Content-Type header. + */ +export const getParseAs = (contentType: string | null): Exclude => { + if (!contentType) { + // If no Content-Type header is provided, the best we can do is return the raw response body, + // which is effectively the same as the 'stream' option. + return 'stream'; + } + + const cleanContent = contentType.split(';')[0]?.trim(); + + if (!cleanContent) { + return; + } + + if (cleanContent.startsWith('application/json') || cleanContent.endsWith('+json')) { + return 'json'; + } + + if (cleanContent === 'multipart/form-data') { + return 'formData'; + } + + if ( + ['application/', 'audio/', 'image/', 'video/'].some((type) => cleanContent.startsWith(type)) + ) { + return 'blob'; + } + + if (cleanContent.startsWith('text/')) { + return 'text'; + } + + return; +}; + +const checkForExistence = ( + options: Pick & { + headers: Headers; + }, + name?: string, +): boolean => { + if (!name) { + return false; + } + if ( + options.headers.has(name) || + options.query?.[name] || + options.headers.get('Cookie')?.includes(`${name}=`) + ) { + return true; + } + return false; +}; + +export const setAuthParams = async ({ + security, + ...options +}: Pick, 'security'> & + Pick & { + headers: Headers; + }) => { + for (const auth of security) { + if (checkForExistence(options, auth.name)) { + continue; + } + + const token = await getAuthToken(auth, options.auth); + + if (!token) { + continue; + } + + const name = auth.name ?? 'Authorization'; + + switch (auth.in) { + case 'query': + if (!options.query) { + options.query = {}; + } + options.query[name] = token; + break; + case 'cookie': + options.headers.append('Cookie', `${name}=${token}`); + break; + case 'header': + default: + options.headers.set(name, token); + break; + } + } +}; + +export const buildUrl: Client['buildUrl'] = (options) => + getUrl({ + baseUrl: options.baseUrl as string, + path: options.path, + query: options.query, + querySerializer: + typeof options.querySerializer === 'function' + ? options.querySerializer + : createQuerySerializer(options.querySerializer), + url: options.url, + }); + +export const mergeConfigs = (a: Config, b: Config): Config => { + const config = { ...a, ...b }; + if (config.baseUrl?.endsWith('/')) { + config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1); + } + config.headers = mergeHeaders(a.headers, b.headers); + return config; +}; + +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + +export const mergeHeaders = ( + ...headers: Array['headers'] | undefined> +): Headers => { + const mergedHeaders = new Headers(); + for (const header of headers) { + if (!header) { + continue; + } + + const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header); + + for (const [key, value] of iterator) { + if (value === null) { + mergedHeaders.delete(key); + } else if (Array.isArray(value)) { + for (const v of value) { + mergedHeaders.append(key, v as string); + } + } else if (value !== undefined) { + // assume object headers are meant to be JSON stringified, i.e. their + // content value in OpenAPI specification is 'application/json' + mergedHeaders.set( + key, + typeof value === 'object' ? JSON.stringify(value) : (value as string), + ); + } + } + } + return mergedHeaders; +}; + +type ErrInterceptor = ( + error: Err, + response: Res, + request: Req, + options: Options, +) => Err | Promise; + +type ReqInterceptor = (request: Req, options: Options) => Req | Promise; + +type ResInterceptor = ( + response: Res, + request: Req, + options: Options, +) => Res | Promise; + +class Interceptors { + fns: Array = []; + + clear(): void { + this.fns = []; + } + + eject(id: number | Interceptor): void { + const index = this.getInterceptorIndex(id); + if (this.fns[index]) { + this.fns[index] = null; + } + } + + exists(id: number | Interceptor): boolean { + const index = this.getInterceptorIndex(id); + return Boolean(this.fns[index]); + } + + getInterceptorIndex(id: number | Interceptor): number { + if (typeof id === 'number') { + return this.fns[id] ? id : -1; + } + return this.fns.indexOf(id); + } + + update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false { + const index = this.getInterceptorIndex(id); + if (this.fns[index]) { + this.fns[index] = fn; + return id; + } + return false; + } + + use(fn: Interceptor): number { + this.fns.push(fn); + return this.fns.length - 1; + } +} + +export interface Middleware { + error: Interceptors>; + request: Interceptors>; + response: Interceptors>; +} + +export const createInterceptors = (): Middleware< + Req, + Res, + Err, + Options +> => ({ + error: new Interceptors>(), + request: new Interceptors>(), + response: new Interceptors>(), +}); + +const defaultQuerySerializer = createQuerySerializer({ + allowReserved: false, + array: { + explode: true, + style: 'form', + }, + object: { + explode: true, + style: 'deepObject', + }, +}); + +const defaultHeaders = { + 'Content-Type': 'application/json', +}; + +export const createConfig = ( + override: Config & T> = {}, +): Config & T> => ({ + ...jsonBodySerializer, + headers: defaultHeaders, + parseAs: 'auto', + querySerializer: defaultQuerySerializer, + ...override, +}); diff --git a/vtex/server/generated/bulk-pricing/core/auth.gen.ts b/vtex/server/generated/bulk-pricing/core/auth.gen.ts new file mode 100644 index 00000000..3ebf9947 --- /dev/null +++ b/vtex/server/generated/bulk-pricing/core/auth.gen.ts @@ -0,0 +1,41 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type AuthToken = string | undefined; + +export interface Auth { + /** + * Which part of the request do we use to send the auth? + * + * @default 'header' + */ + in?: 'header' | 'query' | 'cookie'; + /** + * Header or query parameter name. + * + * @default 'Authorization' + */ + name?: string; + scheme?: 'basic' | 'bearer'; + type: 'apiKey' | 'http'; +} + +export const getAuthToken = async ( + auth: Auth, + callback: ((auth: Auth) => Promise | AuthToken) | AuthToken, +): Promise => { + const token = typeof callback === 'function' ? await callback(auth) : callback; + + if (!token) { + return; + } + + if (auth.scheme === 'bearer') { + return `Bearer ${token}`; + } + + if (auth.scheme === 'basic') { + return `Basic ${btoa(token)}`; + } + + return token; +}; diff --git a/vtex/server/generated/bulk-pricing/core/bodySerializer.gen.ts b/vtex/server/generated/bulk-pricing/core/bodySerializer.gen.ts new file mode 100644 index 00000000..8ad92c9f --- /dev/null +++ b/vtex/server/generated/bulk-pricing/core/bodySerializer.gen.ts @@ -0,0 +1,84 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { ArrayStyle, ObjectStyle, SerializerOptions } from './pathSerializer.gen'; + +export type QuerySerializer = (query: Record) => string; + +export type BodySerializer = (body: any) => any; + +type QuerySerializerOptionsObject = { + allowReserved?: boolean; + array?: Partial>; + object?: Partial>; +}; + +export type QuerySerializerOptions = QuerySerializerOptionsObject & { + /** + * Per-parameter serialization overrides. When provided, these settings + * override the global array/object settings for specific parameter names. + */ + parameters?: Record; +}; + +const serializeFormDataPair = (data: FormData, key: string, value: unknown): void => { + if (typeof value === 'string' || value instanceof Blob) { + data.append(key, value); + } else if (value instanceof Date) { + data.append(key, value.toISOString()); + } else { + data.append(key, JSON.stringify(value)); + } +}; + +const serializeUrlSearchParamsPair = (data: URLSearchParams, key: string, value: unknown): void => { + if (typeof value === 'string') { + data.append(key, value); + } else { + data.append(key, JSON.stringify(value)); + } +}; + +export const formDataBodySerializer = { + bodySerializer: | Array>>( + body: T, + ): FormData => { + const data = new FormData(); + + Object.entries(body).forEach(([key, value]) => { + if (value === undefined || value === null) { + return; + } + if (Array.isArray(value)) { + value.forEach((v) => serializeFormDataPair(data, key, v)); + } else { + serializeFormDataPair(data, key, value); + } + }); + + return data; + }, +}; + +export const jsonBodySerializer = { + bodySerializer: (body: T): string => + JSON.stringify(body, (_key, value) => (typeof value === 'bigint' ? value.toString() : value)), +}; + +export const urlSearchParamsBodySerializer = { + bodySerializer: | Array>>(body: T): string => { + const data = new URLSearchParams(); + + Object.entries(body).forEach(([key, value]) => { + if (value === undefined || value === null) { + return; + } + if (Array.isArray(value)) { + value.forEach((v) => serializeUrlSearchParamsPair(data, key, v)); + } else { + serializeUrlSearchParamsPair(data, key, value); + } + }); + + return data.toString(); + }, +}; diff --git a/vtex/server/generated/bulk-pricing/core/params.gen.ts b/vtex/server/generated/bulk-pricing/core/params.gen.ts new file mode 100644 index 00000000..6099cab1 --- /dev/null +++ b/vtex/server/generated/bulk-pricing/core/params.gen.ts @@ -0,0 +1,169 @@ +// This file is auto-generated by @hey-api/openapi-ts + +type Slot = 'body' | 'headers' | 'path' | 'query'; + +export type Field = + | { + in: Exclude; + /** + * Field name. This is the name we want the user to see and use. + */ + key: string; + /** + * Field mapped name. This is the name we want to use in the request. + * If omitted, we use the same value as `key`. + */ + map?: string; + } + | { + in: Extract; + /** + * Key isn't required for bodies. + */ + key?: string; + map?: string; + } + | { + /** + * Field name. This is the name we want the user to see and use. + */ + key: string; + /** + * Field mapped name. This is the name we want to use in the request. + * If `in` is omitted, `map` aliases `key` to the transport layer. + */ + map: Slot; + }; + +export interface Fields { + allowExtra?: Partial>; + args?: ReadonlyArray; +} + +export type FieldsConfig = ReadonlyArray; + +const extraPrefixesMap: Record = { + $body_: 'body', + $headers_: 'headers', + $path_: 'path', + $query_: 'query', +}; +const extraPrefixes = Object.entries(extraPrefixesMap); + +type KeyMap = Map< + string, + | { + in: Slot; + map?: string; + } + | { + in?: never; + map: Slot; + } +>; + +const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { + if (!map) { + map = new Map(); + } + + for (const config of fields) { + if ('in' in config) { + if (config.key) { + map.set(config.key, { + in: config.in, + map: config.map, + }); + } + } else if ('key' in config) { + map.set(config.key, { + map: config.map, + }); + } else if (config.args) { + buildKeyMap(config.args, map); + } + } + + return map; +}; + +interface Params { + body: unknown; + headers: Record; + path: Record; + query: Record; +} + +const stripEmptySlots = (params: Params) => { + for (const [slot, value] of Object.entries(params)) { + if (value && typeof value === 'object' && !Object.keys(value).length) { + delete params[slot as Slot]; + } + } +}; + +export const buildClientParams = (args: ReadonlyArray, fields: FieldsConfig) => { + const params: Params = { + body: {}, + headers: {}, + path: {}, + query: {}, + }; + + const map = buildKeyMap(fields); + + let config: FieldsConfig[number] | undefined; + + for (const [index, arg] of args.entries()) { + if (fields[index]) { + config = fields[index]; + } + + if (!config) { + continue; + } + + if ('in' in config) { + if (config.key) { + const field = map.get(config.key)!; + const name = field.map || config.key; + if (field.in) { + (params[field.in] as Record)[name] = arg; + } + } else { + params.body = arg; + } + } else { + for (const [key, value] of Object.entries(arg ?? {})) { + const field = map.get(key); + + if (field) { + if (field.in) { + const name = field.map || key; + (params[field.in] as Record)[name] = value; + } else { + params[field.map] = value; + } + } else { + const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix)); + + if (extra) { + const [prefix, slot] = extra; + (params[slot] as Record)[key.slice(prefix.length)] = value; + } else if ('allowExtra' in config && config.allowExtra) { + for (const [slot, allowed] of Object.entries(config.allowExtra)) { + if (allowed) { + (params[slot as Slot] as Record)[key] = value; + break; + } + } + } + } + } + } + } + + stripEmptySlots(params); + + return params; +}; diff --git a/vtex/server/generated/bulk-pricing/core/pathSerializer.gen.ts b/vtex/server/generated/bulk-pricing/core/pathSerializer.gen.ts new file mode 100644 index 00000000..994b2848 --- /dev/null +++ b/vtex/server/generated/bulk-pricing/core/pathSerializer.gen.ts @@ -0,0 +1,171 @@ +// This file is auto-generated by @hey-api/openapi-ts + +interface SerializeOptions extends SerializePrimitiveOptions, SerializerOptions {} + +interface SerializePrimitiveOptions { + allowReserved?: boolean; + name: string; +} + +export interface SerializerOptions { + /** + * @default true + */ + explode: boolean; + style: T; +} + +export type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited'; +export type ArraySeparatorStyle = ArrayStyle | MatrixStyle; +type MatrixStyle = 'label' | 'matrix' | 'simple'; +export type ObjectStyle = 'form' | 'deepObject'; +type ObjectSeparatorStyle = ObjectStyle | MatrixStyle; + +interface SerializePrimitiveParam extends SerializePrimitiveOptions { + value: string; +} + +export const separatorArrayExplode = (style: ArraySeparatorStyle) => { + switch (style) { + case 'label': + return '.'; + case 'matrix': + return ';'; + case 'simple': + return ','; + default: + return '&'; + } +}; + +export const separatorArrayNoExplode = (style: ArraySeparatorStyle) => { + switch (style) { + case 'form': + return ','; + case 'pipeDelimited': + return '|'; + case 'spaceDelimited': + return '%20'; + default: + return ','; + } +}; + +export const separatorObjectExplode = (style: ObjectSeparatorStyle) => { + switch (style) { + case 'label': + return '.'; + case 'matrix': + return ';'; + case 'simple': + return ','; + default: + return '&'; + } +}; + +export const serializeArrayParam = ({ + allowReserved, + explode, + name, + style, + value, +}: SerializeOptions & { + value: unknown[]; +}) => { + if (!explode) { + const joinedValues = ( + allowReserved ? value : value.map((v) => encodeURIComponent(v as string)) + ).join(separatorArrayNoExplode(style)); + switch (style) { + case 'label': + return `.${joinedValues}`; + case 'matrix': + return `;${name}=${joinedValues}`; + case 'simple': + return joinedValues; + default: + return `${name}=${joinedValues}`; + } + } + + const separator = separatorArrayExplode(style); + const joinedValues = value + .map((v) => { + if (style === 'label' || style === 'simple') { + return allowReserved ? v : encodeURIComponent(v as string); + } + + return serializePrimitiveParam({ + allowReserved, + name, + value: v as string, + }); + }) + .join(separator); + return style === 'label' || style === 'matrix' ? separator + joinedValues : joinedValues; +}; + +export const serializePrimitiveParam = ({ + allowReserved, + name, + value, +}: SerializePrimitiveParam) => { + if (value === undefined || value === null) { + return ''; + } + + if (typeof value === 'object') { + throw new Error( + 'Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.', + ); + } + + return `${name}=${allowReserved ? value : encodeURIComponent(value)}`; +}; + +export const serializeObjectParam = ({ + allowReserved, + explode, + name, + style, + value, + valueOnly, +}: SerializeOptions & { + value: Record | Date; + valueOnly?: boolean; +}) => { + if (value instanceof Date) { + return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`; + } + + if (style !== 'deepObject' && !explode) { + let values: string[] = []; + Object.entries(value).forEach(([key, v]) => { + values = [...values, key, allowReserved ? (v as string) : encodeURIComponent(v as string)]; + }); + const joinedValues = values.join(','); + switch (style) { + case 'form': + return `${name}=${joinedValues}`; + case 'label': + return `.${joinedValues}`; + case 'matrix': + return `;${name}=${joinedValues}`; + default: + return joinedValues; + } + } + + const separator = separatorObjectExplode(style); + const joinedValues = Object.entries(value) + .map(([key, v]) => + serializePrimitiveParam({ + allowReserved, + name: style === 'deepObject' ? `${name}[${key}]` : key, + value: v as string, + }), + ) + .join(separator); + return style === 'label' || style === 'matrix' ? separator + joinedValues : joinedValues; +}; diff --git a/vtex/server/generated/bulk-pricing/core/queryKeySerializer.gen.ts b/vtex/server/generated/bulk-pricing/core/queryKeySerializer.gen.ts new file mode 100644 index 00000000..5000df60 --- /dev/null +++ b/vtex/server/generated/bulk-pricing/core/queryKeySerializer.gen.ts @@ -0,0 +1,117 @@ +// This file is auto-generated by @hey-api/openapi-ts + +/** + * JSON-friendly union that mirrors what Pinia Colada can hash. + */ +export type JsonValue = + | null + | string + | number + | boolean + | JsonValue[] + | { [key: string]: JsonValue }; + +/** + * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes. + */ +export const queryKeyJsonReplacer = (_key: string, value: unknown) => { + if (value === undefined || typeof value === 'function' || typeof value === 'symbol') { + return undefined; + } + if (typeof value === 'bigint') { + return value.toString(); + } + if (value instanceof Date) { + return value.toISOString(); + } + return value; +}; + +/** + * Safely stringifies a value and parses it back into a JsonValue. + */ +export const stringifyToJsonValue = (input: unknown): JsonValue | undefined => { + try { + const json = JSON.stringify(input, queryKeyJsonReplacer); + if (json === undefined) { + return undefined; + } + return JSON.parse(json) as JsonValue; + } catch { + return undefined; + } +}; + +/** + * Detects plain objects (including objects with a null prototype). + */ +const isPlainObject = (value: unknown): value is Record => { + if (value === null || typeof value !== 'object') { + return false; + } + const prototype = Object.getPrototypeOf(value as object); + return prototype === Object.prototype || prototype === null; +}; + +/** + * Turns URLSearchParams into a sorted JSON object for deterministic keys. + */ +const serializeSearchParams = (params: URLSearchParams): JsonValue => { + const entries = Array.from(params.entries()).sort(([a], [b]) => a.localeCompare(b)); + const result: Record = {}; + + for (const [key, value] of entries) { + const existing = result[key]; + if (existing === undefined) { + result[key] = value; + continue; + } + + if (Array.isArray(existing)) { + (existing as string[]).push(value); + } else { + result[key] = [existing, value]; + } + } + + return result; +}; + +/** + * Normalizes any accepted value into a JSON-friendly shape for query keys. + */ +export const serializeQueryKeyValue = (value: unknown): JsonValue | undefined => { + if (value === null) { + return null; + } + + if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { + return value; + } + + if (value === undefined || typeof value === 'function' || typeof value === 'symbol') { + return undefined; + } + + if (typeof value === 'bigint') { + return value.toString(); + } + + if (value instanceof Date) { + return value.toISOString(); + } + + if (Array.isArray(value)) { + return stringifyToJsonValue(value); + } + + if (typeof URLSearchParams !== 'undefined' && value instanceof URLSearchParams) { + return serializeSearchParams(value); + } + + if (isPlainObject(value)) { + return stringifyToJsonValue(value); + } + + return undefined; +}; diff --git a/vtex/server/generated/bulk-pricing/core/serverSentEvents.gen.ts b/vtex/server/generated/bulk-pricing/core/serverSentEvents.gen.ts new file mode 100644 index 00000000..6aa6cf02 --- /dev/null +++ b/vtex/server/generated/bulk-pricing/core/serverSentEvents.gen.ts @@ -0,0 +1,243 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Config } from './types.gen'; + +export type ServerSentEventsOptions = Omit & + Pick & { + /** + * Fetch API implementation. You can use this option to provide a custom + * fetch instance. + * + * @default globalThis.fetch + */ + fetch?: typeof fetch; + /** + * Implementing clients can call request interceptors inside this hook. + */ + onRequest?: (url: string, init: RequestInit) => Promise; + /** + * Callback invoked when a network or parsing error occurs during streaming. + * + * This option applies only if the endpoint returns a stream of events. + * + * @param error The error that occurred. + */ + onSseError?: (error: unknown) => void; + /** + * Callback invoked when an event is streamed from the server. + * + * This option applies only if the endpoint returns a stream of events. + * + * @param event Event streamed from the server. + * @returns Nothing (void). + */ + onSseEvent?: (event: StreamEvent) => void; + serializedBody?: RequestInit['body']; + /** + * Default retry delay in milliseconds. + * + * This option applies only if the endpoint returns a stream of events. + * + * @default 3000 + */ + sseDefaultRetryDelay?: number; + /** + * Maximum number of retry attempts before giving up. + */ + sseMaxRetryAttempts?: number; + /** + * Maximum retry delay in milliseconds. + * + * Applies only when exponential backoff is used. + * + * This option applies only if the endpoint returns a stream of events. + * + * @default 30000 + */ + sseMaxRetryDelay?: number; + /** + * Optional sleep function for retry backoff. + * + * Defaults to using `setTimeout`. + */ + sseSleepFn?: (ms: number) => Promise; + url: string; + }; + +export interface StreamEvent { + data: TData; + event?: string; + id?: string; + retry?: number; +} + +export type ServerSentEventsResult = { + stream: AsyncGenerator< + TData extends Record ? TData[keyof TData] : TData, + TReturn, + TNext + >; +}; + +export const createSseClient = ({ + onRequest, + onSseError, + onSseEvent, + responseTransformer, + responseValidator, + sseDefaultRetryDelay, + sseMaxRetryAttempts, + sseMaxRetryDelay, + sseSleepFn, + url, + ...options +}: ServerSentEventsOptions): ServerSentEventsResult => { + let lastEventId: string | undefined; + + const sleep = sseSleepFn ?? ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms))); + + const createStream = async function* () { + let retryDelay: number = sseDefaultRetryDelay ?? 3000; + let attempt = 0; + const signal = options.signal ?? new AbortController().signal; + + while (true) { + if (signal.aborted) break; + + attempt++; + + const headers = + options.headers instanceof Headers + ? options.headers + : new Headers(options.headers as Record | undefined); + + if (lastEventId !== undefined) { + headers.set('Last-Event-ID', lastEventId); + } + + try { + const requestInit: RequestInit = { + redirect: 'follow', + ...options, + body: options.serializedBody, + headers, + signal, + }; + let request = new Request(url, requestInit); + if (onRequest) { + request = await onRequest(url, requestInit); + } + // fetch must be assigned here, otherwise it would throw the error: + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation + const _fetch = options.fetch ?? globalThis.fetch; + const response = await _fetch(request); + + if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`); + + if (!response.body) throw new Error('No body in SSE response'); + + const reader = response.body.pipeThrough(new TextDecoderStream()).getReader(); + + let buffer = ''; + + const abortHandler = () => { + try { + reader.cancel(); + } catch { + // noop + } + }; + + signal.addEventListener('abort', abortHandler); + + try { + while (true) { + const { done, value } = await reader.read(); + if (done) break; + buffer += value; + // Normalize line endings: CRLF -> LF, then CR -> LF + buffer = buffer.replace(/\r\n/g, '\n').replace(/\r/g, '\n'); + + const chunks = buffer.split('\n\n'); + buffer = chunks.pop() ?? ''; + + for (const chunk of chunks) { + const lines = chunk.split('\n'); + const dataLines: Array = []; + let eventName: string | undefined; + + for (const line of lines) { + if (line.startsWith('data:')) { + dataLines.push(line.replace(/^data:\s*/, '')); + } else if (line.startsWith('event:')) { + eventName = line.replace(/^event:\s*/, ''); + } else if (line.startsWith('id:')) { + lastEventId = line.replace(/^id:\s*/, ''); + } else if (line.startsWith('retry:')) { + const parsed = Number.parseInt(line.replace(/^retry:\s*/, ''), 10); + if (!Number.isNaN(parsed)) { + retryDelay = parsed; + } + } + } + + let data: unknown; + let parsedJson = false; + + if (dataLines.length) { + const rawData = dataLines.join('\n'); + try { + data = JSON.parse(rawData); + parsedJson = true; + } catch { + data = rawData; + } + } + + if (parsedJson) { + if (responseValidator) { + await responseValidator(data); + } + + if (responseTransformer) { + data = await responseTransformer(data); + } + } + + onSseEvent?.({ + data, + event: eventName, + id: lastEventId, + retry: retryDelay, + }); + + if (dataLines.length) { + yield data as any; + } + } + } + } finally { + signal.removeEventListener('abort', abortHandler); + reader.releaseLock(); + } + + break; // exit loop on normal completion + } catch (error) { + // connection failed or aborted; retry after delay + onSseError?.(error); + + if (sseMaxRetryAttempts !== undefined && attempt >= sseMaxRetryAttempts) { + break; // stop after firing error + } + + // exponential backoff: double retry each attempt, cap at 30s + const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 30000); + await sleep(backoff); + } + } + }; + + const stream = createStream(); + + return { stream }; +}; diff --git a/vtex/server/generated/bulk-pricing/core/types.gen.ts b/vtex/server/generated/bulk-pricing/core/types.gen.ts new file mode 100644 index 00000000..97463257 --- /dev/null +++ b/vtex/server/generated/bulk-pricing/core/types.gen.ts @@ -0,0 +1,104 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Auth, AuthToken } from './auth.gen'; +import type { BodySerializer, QuerySerializer, QuerySerializerOptions } from './bodySerializer.gen'; + +export type HttpMethod = + | 'connect' + | 'delete' + | 'get' + | 'head' + | 'options' + | 'patch' + | 'post' + | 'put' + | 'trace'; + +export type Client< + RequestFn = never, + Config = unknown, + MethodFn = never, + BuildUrlFn = never, + SseFn = never, +> = { + /** + * Returns the final request URL. + */ + buildUrl: BuildUrlFn; + getConfig: () => Config; + request: RequestFn; + setConfig: (config: Config) => Config; +} & { + [K in HttpMethod]: MethodFn; +} & ([SseFn] extends [never] ? { sse?: never } : { sse: { [K in HttpMethod]: SseFn } }); + +export interface Config { + /** + * Auth token or a function returning auth token. The resolved value will be + * added to the request payload as defined by its `security` array. + */ + auth?: ((auth: Auth) => Promise | AuthToken) | AuthToken; + /** + * A function for serializing request body parameter. By default, + * {@link JSON.stringify()} will be used. + */ + bodySerializer?: BodySerializer | null; + /** + * An object containing any HTTP headers that you want to pre-populate your + * `Headers` object with. + * + * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more} + */ + headers?: + | RequestInit['headers'] + | Record< + string, + string | number | boolean | (string | number | boolean)[] | null | undefined | unknown + >; + /** + * The request method. + * + * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more} + */ + method?: Uppercase; + /** + * A function for serializing request query parameters. By default, arrays + * will be exploded in form style, objects will be exploded in deepObject + * style, and reserved characters are percent-encoded. + * + * This method will have no effect if the native `paramsSerializer()` Axios + * API function is used. + * + * {@link https://swagger.io/docs/specification/serialization/#query View examples} + */ + querySerializer?: QuerySerializer | QuerySerializerOptions; + /** + * A function validating request data. This is useful if you want to ensure + * the request conforms to the desired shape, so it can be safely sent to + * the server. + */ + requestValidator?: (data: unknown) => Promise; + /** + * A function transforming response data before it's returned. This is useful + * for post-processing data, e.g. converting ISO strings into Date objects. + */ + responseTransformer?: (data: unknown) => Promise; + /** + * A function validating response data. This is useful if you want to ensure + * the response conforms to the desired shape, so it can be safely passed to + * the transformers and returned to the user. + */ + responseValidator?: (data: unknown) => Promise; +} + +type IsExactlyNeverOrNeverUndefined = [T] extends [never] + ? true + : [T] extends [never | undefined] + ? [undefined] extends [T] + ? false + : true + : false; + +export type OmitNever> = { + [K in keyof T as IsExactlyNeverOrNeverUndefined extends true ? never : K]: T[K]; +}; diff --git a/vtex/server/generated/bulk-pricing/core/utils.gen.ts b/vtex/server/generated/bulk-pricing/core/utils.gen.ts new file mode 100644 index 00000000..e7ddbe35 --- /dev/null +++ b/vtex/server/generated/bulk-pricing/core/utils.gen.ts @@ -0,0 +1,140 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; +import { + type ArraySeparatorStyle, + serializeArrayParam, + serializeObjectParam, + serializePrimitiveParam, +} from './pathSerializer.gen'; + +export interface PathSerializer { + path: Record; + url: string; +} + +export const PATH_PARAM_RE = /\{[^{}]+\}/g; + +export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { + let url = _url; + const matches = _url.match(PATH_PARAM_RE); + if (matches) { + for (const match of matches) { + let explode = false; + let name = match.substring(1, match.length - 1); + let style: ArraySeparatorStyle = 'simple'; + + if (name.endsWith('*')) { + explode = true; + name = name.substring(0, name.length - 1); + } + + if (name.startsWith('.')) { + name = name.substring(1); + style = 'label'; + } else if (name.startsWith(';')) { + name = name.substring(1); + style = 'matrix'; + } + + const value = path[name]; + + if (value === undefined || value === null) { + continue; + } + + if (Array.isArray(value)) { + url = url.replace(match, serializeArrayParam({ explode, name, style, value })); + continue; + } + + if (typeof value === 'object') { + url = url.replace( + match, + serializeObjectParam({ + explode, + name, + style, + value: value as Record, + valueOnly: true, + }), + ); + continue; + } + + if (style === 'matrix') { + url = url.replace( + match, + `;${serializePrimitiveParam({ + name, + value: value as string, + })}`, + ); + continue; + } + + const replaceValue = encodeURIComponent( + style === 'label' ? `.${value as string}` : (value as string), + ); + url = url.replace(match, replaceValue); + } + } + return url; +}; + +export const getUrl = ({ + baseUrl, + path, + query, + querySerializer, + url: _url, +}: { + baseUrl?: string; + path?: Record; + query?: Record; + querySerializer: QuerySerializer; + url: string; +}) => { + const pathUrl = _url.startsWith('/') ? _url : `/${_url}`; + let url = (baseUrl ?? '') + pathUrl; + if (path) { + url = defaultPathSerializer({ path, url }); + } + let search = query ? querySerializer(query) : ''; + if (search.startsWith('?')) { + search = search.substring(1); + } + if (search) { + url += `?${search}`; + } + return url; +}; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // not all clients implement a serializedBody property (i.e. client-axios) + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/vtex/server/generated/bulk-pricing/index.ts b/vtex/server/generated/bulk-pricing/index.ts new file mode 100644 index 00000000..1b1fc242 --- /dev/null +++ b/vtex/server/generated/bulk-pricing/index.ts @@ -0,0 +1,4 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export { getApiPriceImporterPvtBatchesByBatchId, getApiPriceImporterPvtBatchesByBatchIdErrors, type Options, postApiPriceImporterPvtImportByImportType } from './sdk.gen'; +export type { Accept, ClientOptions, ContentType, GetApiPriceImporterPvtBatchesByBatchIdData, GetApiPriceImporterPvtBatchesByBatchIdErrors, GetApiPriceImporterPvtBatchesByBatchIdErrorsData, GetApiPriceImporterPvtBatchesByBatchIdErrorsErrors, GetApiPriceImporterPvtBatchesByBatchIdErrorsResponse, GetApiPriceImporterPvtBatchesByBatchIdErrorsResponses, GetApiPriceImporterPvtBatchesByBatchIdResponse, GetApiPriceImporterPvtBatchesByBatchIdResponses, PostApiPriceImporterPvtImportByImportTypeData, PostApiPriceImporterPvtImportByImportTypeErrors, PostApiPriceImporterPvtImportByImportTypeResponse, PostApiPriceImporterPvtImportByImportTypeResponses } from './types.gen'; diff --git a/vtex/server/generated/bulk-pricing/sdk.gen.ts b/vtex/server/generated/bulk-pricing/sdk.gen.ts new file mode 100644 index 00000000..b9bb75ac --- /dev/null +++ b/vtex/server/generated/bulk-pricing/sdk.gen.ts @@ -0,0 +1,121 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Client, Options as Options2, TDataShape } from './client'; +import { client } from './client.gen'; +import type { GetApiPriceImporterPvtBatchesByBatchIdData, GetApiPriceImporterPvtBatchesByBatchIdErrors, GetApiPriceImporterPvtBatchesByBatchIdErrorsData, GetApiPriceImporterPvtBatchesByBatchIdErrorsErrors, GetApiPriceImporterPvtBatchesByBatchIdErrorsResponses, GetApiPriceImporterPvtBatchesByBatchIdResponses, PostApiPriceImporterPvtImportByImportTypeData, PostApiPriceImporterPvtImportByImportTypeErrors, PostApiPriceImporterPvtImportByImportTypeResponses } from './types.gen'; + +export type Options = Options2 & { + /** + * You can provide a client instance returned by `createClient()` instead of + * individual options. This might be also useful if you want to implement a + * custom client. + */ + client?: Client; + /** + * You can pass arbitrary values through the `meta` object. This can be + * used to access values that aren't defined as part of the SDK function. + */ + meta?: Record; +}; + +/** + * Import prices + * + * Starts an asynchronous batch pricing import job. Send a request specifying the import type (`base-prices` for base prices or `fixed-prices` for fixed prices) and the file metadata. The API returns a pre-signed upload URL and a unique batch ID to track the import. + * + * After receiving the response, upload the CSV file directly to the pre-signed URL returned in `upload.url` using the `PUT` method. This pre-signed URL is mandatory for the upload step. Do not replace it with the API base URL or any other endpoint. + * + * The upload request must include the header `Content-Type: text/csv`, along with any additional headers provided in the `upload.headers` object. The maximum file size is 500 MB. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/authentication-overview#api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise, they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Pricing | Price List | **Modify prices** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. + * + * To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication-overview#machine-authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const postApiPriceImporterPvtImportByImportType = (options: Options) => (options.client ?? client).post({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/price-importer/pvt/import/{importType}', + ...options +}); + +/** + * Get batch status + * + * Retrieves the current status and metadata of a batch pricing import job. + * + * The `status` field indicates the current processing stage and can have the following values: + * + * - `AWAITING_UPLOAD`: Batch created, waiting for file upload. + * - `RECEIVED`: Waiting for processing. + * - `VALIDATING`: An initial file validation is being performed. + * - `PROCESSING`: Batch is being processed. + * - `DOCUMENTING`: The import results are being generated. + * - `COMPLETED`: All rows processed successfully. + * - `COMPLETED_WITH_ERRORS`: Processing finished with some row errors. + * - `FAILED`: Processing failed. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/authentication-overview#api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise, they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Pricing | Price List | **Read prices** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. + * + * To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication-overview#machine-authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const getApiPriceImporterPvtBatchesByBatchId = (options: Options) => (options.client ?? client).get({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/price-importer/pvt/batches/{batchId}', + ...options +}); + +/** + * Get batch errors + * + * Retrieves a pre-signed URL containing a CSV file with the errors from a batch pricing import job. The CSV file has the same format as the import file, with two additional columns: `Error Code` and `Error Message`. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/authentication-overview#api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise, they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Pricing | Price List | **Read prices** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. + * + * To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication-overview#machine-authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const getApiPriceImporterPvtBatchesByBatchIdErrors = (options: Options) => (options.client ?? client).get({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/price-importer/pvt/batches/{batchId}/errors', + ...options +}); diff --git a/vtex/server/generated/bulk-pricing/types.gen.ts b/vtex/server/generated/bulk-pricing/types.gen.ts new file mode 100644 index 00000000..6e7867c9 --- /dev/null +++ b/vtex/server/generated/bulk-pricing/types.gen.ts @@ -0,0 +1,262 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type ClientOptions = { + baseUrl: 'https://{accountName}.{environment}.com.br' | (string & {}); +}; + +/** + * Type of the content being sent. + */ +export type ContentType = string; + +/** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ +export type Accept = string; + +export type PostApiPriceImporterPvtImportByImportTypeData = { + body?: { + /** + * MIME type of the file. Must be `text/csv`. + */ + contentType: string; + /** + * File size in bytes. Used for upload validation. + */ + contentLengthBytes: number; + }; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path: { + /** + * Type of price import. Use `base-prices` for base prices or `fixed-prices` for fixed prices. + */ + importType: 'base-prices' | 'fixed-prices'; + }; + query?: { + /** + * Tenant account identifier. Can be sent as a query string or identified through the host URL. + */ + an?: string; + /** + * Output notification method for when the import job finishes. The target email is configured separately. + */ + output?: 'none' | 'email'; + }; + url: '/api/price-importer/pvt/import/{importType}'; +}; + +export type PostApiPriceImporterPvtImportByImportTypeErrors = { + /** + * Unauthorized + */ + 401: unknown; + /** + * Forbidden + */ + 403: unknown; + /** + * Payload Too Large + * + * File exceeds the 500 MB size limit. + */ + 413: unknown; + /** + * Unprocessable Entity + * + * Validation error in the file or its rows. + */ + 422: unknown; + /** + * Too Many Requests + * + * The rate limit has been exceeded. + */ + 429: unknown; + /** + * Service Unavailable + * + * Retry with exponential backoff. + */ + 503: unknown; +}; + +export type PostApiPriceImporterPvtImportByImportTypeResponses = { + /** + * OK + */ + 200: { + /** + * Unique identifier for the batch job. + */ + batchId?: string; + /** + * Initial status of the batch job. Returns `AWAITING_UPLOAD` indicating the batch was created and is waiting for the file upload. + */ + status?: string; + /** + * Pre-signed upload details used to upload the CSV file directly to storage. + */ + upload?: { + /** + * HTTP method to use for the upload. Always `PUT`. + */ + method?: string; + /** + * Pre-signed URL for the CSV file upload. + */ + url?: string; + /** + * Required headers for the upload request. + */ + headers?: { + [key: string]: unknown; + }; + /** + * URL expiration timestamp in ISO 8601 format. + */ + expiresAt?: string; + }; + }; +}; + +export type PostApiPriceImporterPvtImportByImportTypeResponse = PostApiPriceImporterPvtImportByImportTypeResponses[keyof PostApiPriceImporterPvtImportByImportTypeResponses]; + +export type GetApiPriceImporterPvtBatchesByBatchIdData = { + body?: never; + headers: { + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path: { + /** + * Unique identifier of the batch job. + */ + batchId: string; + }; + query?: never; + url: '/api/price-importer/pvt/batches/{batchId}'; +}; + +export type GetApiPriceImporterPvtBatchesByBatchIdErrors = { + /** + * Unauthorized + */ + 401: unknown; + /** + * Forbidden + */ + 403: unknown; +}; + +export type GetApiPriceImporterPvtBatchesByBatchIdResponses = { + /** + * OK + */ + 200: { + /** + * Unique identifier for the batch job. + */ + batchId?: string; + /** + * Type of price import job. + */ + type?: 'base' | 'fixed'; + /** + * Current processing status of the batch job. + */ + status?: 'AWAITING_UPLOAD' | 'RECEIVED' | 'VALIDATING' | 'PROCESSING' | 'DOCUMENTING' | 'COMPLETED' | 'COMPLETED_WITH_ERRORS' | 'FAILED'; + /** + * Historical information regarding the past stages and their starting times. + */ + stages?: Array<{ + /** + * Processing status at this stage. + */ + status?: string; + /** + * Timestamp when this stage was reached in ISO 8601 format. + */ + timestamp?: string; + }>; + /** + * List of outputs where the results should be sent after the job is finished (email). + */ + outputs?: Array; + /** + * Amount of bytes processed so far. + */ + bytesProcessed?: number; + /** + * Total amount of bytes in the uploaded file. + */ + bytesTotal?: number; + /** + * Number of rows that failed to be imported due to errors. + */ + errorCount?: number; + /** + * Batch creation timestamp in ISO 8601 format. + */ + createdAt?: string; + /** + * Processing batch start timestamp in ISO 8601 format. + */ + startedAt?: string; + }; +}; + +export type GetApiPriceImporterPvtBatchesByBatchIdResponse = GetApiPriceImporterPvtBatchesByBatchIdResponses[keyof GetApiPriceImporterPvtBatchesByBatchIdResponses]; + +export type GetApiPriceImporterPvtBatchesByBatchIdErrorsData = { + body?: never; + headers: { + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path: { + /** + * Unique identifier of the batch job. + */ + batchId: string; + }; + query?: never; + url: '/api/price-importer/pvt/batches/{batchId}/errors'; +}; + +export type GetApiPriceImporterPvtBatchesByBatchIdErrorsErrors = { + /** + * Unauthorized + */ + 401: unknown; + /** + * Forbidden + */ + 403: unknown; +}; + +export type GetApiPriceImporterPvtBatchesByBatchIdErrorsResponses = { + /** + * OK + */ + 200: { + /** + * Pre-signed URL containing a CSV file with error details. The CSV includes the same columns as the import file plus `Error Code` and `Error Message`. + */ + url?: string; + }; +}; + +export type GetApiPriceImporterPvtBatchesByBatchIdErrorsResponse = GetApiPriceImporterPvtBatchesByBatchIdErrorsResponses[keyof GetApiPriceImporterPvtBatchesByBatchIdErrorsResponses]; diff --git a/vtex/server/generated/bulk-pricing/zod.gen.ts b/vtex/server/generated/bulk-pricing/zod.gen.ts new file mode 100644 index 00000000..2a1458a5 --- /dev/null +++ b/vtex/server/generated/bulk-pricing/zod.gen.ts @@ -0,0 +1,53 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import * as z from 'zod'; + +/** + * Type of the content being sent. + */ +export const zContentType = z.string(); + +/** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ +export const zAccept = z.string(); + +export const zPostApiPriceImporterPvtImportByImportTypeData = z.object({ + body: z.optional(z.object({ + contentType: z.string(), + contentLengthBytes: z.int() + })), + path: z.object({ + importType: z.enum(['base-prices', 'fixed-prices']) + }), + query: z.optional(z.object({ + an: z.optional(z.string()), + output: z.optional(z.enum(['none', 'email'])) + })), + headers: z.object({ + 'Content-Type': z.string(), + Accept: z.string() + }) +}); + +export const zGetApiPriceImporterPvtBatchesByBatchIdData = z.object({ + body: z.optional(z.never()), + path: z.object({ + batchId: z.uuid() + }), + query: z.optional(z.never()), + headers: z.object({ + Accept: z.string() + }) +}); + +export const zGetApiPriceImporterPvtBatchesByBatchIdErrorsData = z.object({ + body: z.optional(z.never()), + path: z.object({ + batchId: z.uuid() + }), + query: z.optional(z.never()), + headers: z.object({ + Accept: z.string() + }) +}); diff --git a/vtex/server/generated/buying-policies/sdk.gen.ts b/vtex/server/generated/buying-policies/sdk.gen.ts index cacb9574..00169b46 100644 --- a/vtex/server/generated/buying-policies/sdk.gen.ts +++ b/vtex/server/generated/buying-policies/sdk.gen.ts @@ -91,11 +91,13 @@ export const getByAccountNameAuthorizationDimensions = ❗ Set `requireAllRulesAcceptance: false` so the first matching rule executes and stops further evaluation. This enables bypass rules to immediately approve orders without checking deny or approval rules. * diff --git a/vtex/server/generated/buying-policies/types.gen.ts b/vtex/server/generated/buying-policies/types.gen.ts index 4d6a307e..79cd83ee 100644 --- a/vtex/server/generated/buying-policies/types.gen.ts +++ b/vtex/server/generated/buying-policies/types.gen.ts @@ -33,7 +33,7 @@ export type CreateUpdateDimensionRequestBody = { */ name: string; /** - * Rule priority controls which policy type is checked first within the org unit. Lower numbers are evaluated first. You can have bypass rules and immediately approve orders by matching effect types with fixed priorities: `1` = bypass (effectType: 0), `2` = deny (effectType: 1), `3` = sequential workflow (effectType: 2). + * Sequential evaluation priority for the rule. Lower numbers are evaluated first. Rules must be ordered: bypass (`effectType: 0`) first, then deny (`effectType: 1`), then sequential workflow (`effectType: 2`). Priorities are assigned sequentially across all rules. */ priority: number; /** @@ -109,7 +109,7 @@ export type CreateUpdateRuleRequestBody = { */ name: string; /** - * Rule priority controls which policy type is checked first within the org unit. Lower numbers are evaluated first. You can have bypass rules and immediately approve orders by matching effect types with fixed priorities: `1` = bypass (effectType: 0), `2` = deny (effectType: 1), `3` = sequential workflow (effectType: 2). + * Sequential evaluation priority for the rule. Lower numbers are evaluated first. Rules must be ordered: bypass (`effectType: 0`) first, then deny (`effectType: 1`), then sequential workflow (`effectType: 2`). Priorities are assigned sequentially across all rules. */ priority: number; /** @@ -448,7 +448,7 @@ export type GetByAccountNameAuthorizationDimensionsResponses = { */ status?: null | 'accepted' | 'denied' | 'pending'; /** - * Evaluation priority for the rule. + * Sequential evaluation priority for the rule. Lower numbers are evaluated first. Rules must be ordered: bypass (`effectType: 0`) first, then deny (`effectType: 1`), then sequential workflow (`effectType: 2`). */ priority?: number; /** @@ -1092,7 +1092,7 @@ export type PostCommercialAuthorizationsByOrderAuthIdCallbackResponses = { */ score?: number; /** - * Rule priority (lower = higher priority). + * Sequential evaluation priority for the rule. Lower numbers are evaluated first. Rules must be ordered: bypass, then deny, then sequential workflow. */ priority?: number; /** diff --git a/vtex/server/generated/catalog/index.ts b/vtex/server/generated/catalog/index.ts index 5d3b1ccd..7b696a7a 100644 --- a/vtex/server/generated/catalog/index.ts +++ b/vtex/server/generated/catalog/index.ts @@ -1,4 +1,4 @@ // This file is auto-generated by @hey-api/openapi-ts -export { associateattachmentstoSku, brand, brandList, brandListPerPage, categoryTree, changeNotification, createSeller, createSkuComplement, deleteAllProductSpecifications, deleteApiCatalogPvtAttachmentByAttachmentid, deleteApiCatalogPvtBrandByBrandId, deleteApiCatalogPvtCollectionByCollectionId, deleteApiCatalogPvtProductByProductIdSalespolicyByTradepolicyId, deleteApiCatalogPvtProductByProductIdSimilarcategoryByCategoryId, deleteApiCatalogPvtSkuattachment, deleteApiCatalogPvtSkuattachmentBySkuAttachmentAssociationId, deleteApiCatalogPvtSkuserviceBySkuServiceId, deleteApiCatalogPvtSkuservicetypeattachment, deleteApiCatalogPvtSkuservicetypeattachmentBySkuServiceTypeAttachmentId, deleteApiCatalogPvtSkuservicetypeBySkuServiceTypeId, deleteApiCatalogPvtSkuservicevalueBySkuServiceValueId, deleteApiCatalogPvtSpecificationNonstructured, deleteApiCatalogPvtSpecificationNonstructuredById, deleteApiCatalogPvtStockkeepingunitBySkuIdAttribute, deleteApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeId, deleteApiCatalogPvtStockkeepingunitBySkuIdEan, deleteApiCatalogPvtStockkeepingunitBySkuIdEanByEan, deleteApiCatalogPvtStockkeepingunitBySkuIdFile, deleteApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileId, deleteApiCatalogPvtStockkeepingunitBySkuIdSpecification, deleteApiCatalogPvtStockkeepingunitBySkuIdSpecificationBySpecificationId, deleteApiCatalogPvtStockkeepingunitDisassociateBySkuIdFileBySkuFileId, deleteApiCatalogPvtStockkeepingunitkit, deleteApiCatalogPvtStockkeepingunitkitByKitId, deleteApiCatalogPvtSubcollectionBySubCollectionId, deleteApiCatalogPvtSubcollectionBySubCollectionIdBrandByBrandId, deleteApiCatalogPvtSubcollectionBySubCollectionIdCategoryByCategoryId, deleteApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalue, deleteApiCatalogPvtSubcollectionBySubCollectionIdStockkeepingunitBySkuId, deleteApiCatalogPvtSupplierBySupplierId, deleteaProductSpecification, deleteSkuComplementbySkuComplementId, deleteSkUsellerassociation, getAllCommercialConditions, getAllInactiveCollections, getApiAddonPvtReviewGetProductRateByProductId, getApiCatalogPvtAttachmentByAttachmentid, getApiCatalogPvtAttachmentByAttachmentIdLanguage, getApiCatalogPvtAttachments, getApiCatalogPvtBrandByBrandId, getApiCatalogPvtBrandByBrandIdLanguage, getApiCatalogPvtCategoryByCategoryId, getApiCatalogPvtCategoryByCategoryIdLanguage, getApiCatalogPvtCollectionByCollectionId, getApiCatalogPvtCollectionByCollectionIdLanguage, getApiCatalogPvtCollectionByCollectionIdSubcollection, getApiCatalogPvtProductByProductIdLanguage, getApiCatalogPvtProductByProductIdSalespolicy, getApiCatalogPvtProductByProductIdSimilarcategory, getApiCatalogPvtProductsByProductIdSpecificationBySpecificationIdLanguage, getApiCatalogPvtSkuserviceBySkuServiceId, getApiCatalogPvtSkuserviceBySkuserviceIdLanguage, getApiCatalogPvtSkuservicetypeBySkuServiceTypeId, getApiCatalogPvtSkuservicetypeBySkuServiceTypeIdLanguage, getApiCatalogPvtSkuservicevalueBySkuServiceValueId, getApiCatalogPvtSkuservicevalueBySkuServiceValueIdLanguage, getApiCatalogPvtSpecificationBySpecificationId, getApiCatalogPvtSpecificationBySpecificationIdLanguage, getApiCatalogPvtSpecificationgroupBySpecificationGroupIdLanguage, getApiCatalogPvtSpecificationNonstructured, getApiCatalogPvtSpecificationNonstructuredById, getApiCatalogPvtSpecificationvalueBySpecificationValueId, getApiCatalogPvtSpecificationvalueByValueIdLanguage, getApiCatalogPvtStockkeepingunit, getApiCatalogPvtStockkeepingunitBySkuIdAttachment, getApiCatalogPvtStockkeepingunitBySkuIdAttribute, getApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeId, getApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdLanguage, getApiCatalogPvtStockkeepingunitBySkuIdEan, getApiCatalogPvtStockkeepingunitBySkuIdFile, getApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdLanguage, getApiCatalogPvtStockkeepingunitBySkuIdLanguage, getApiCatalogPvtStockkeepingunitBySkuIdSpecification, getApiCatalogPvtStockkeepingunitkit, getApiCatalogPvtStockkeepingunitkitByKitId, getApiCatalogPvtSubcollectionBySubCollectionId, getApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalue, getApiCatalogSystemPvtSkuStockkeepingunitidsbysaleschannel, getCommercialConditions, getGiftList, getImportfileexample, getProductbyid, getProductsfromacollection, getProductSpecification, getProductSpecificationbyProductId, getSellerbyId, getSellersbyId, getSkuComplementbySkuComplementId, getSkuComplementbySkuid, getSkuComplementsbyComplementTypeId, getSkUcomplementsbytype, getSkUseller, indexedInfo, listallSkuids, type Options, postAddproductsbyimportfile, postApiCatalogPvtAttachment, postApiCatalogPvtBrand, postApiCatalogPvtCategory, postApiCatalogPvtCollectionByCollectionIdPosition, postApiCatalogPvtProduct, postApiCatalogPvtProductByProductIdSalespolicyByTradepolicyId, postApiCatalogPvtProductByProductIdSimilarcategoryByCategoryId, postApiCatalogPvtProductByProductIdSpecification, postApiCatalogPvtSkuattachment, postApiCatalogPvtSkuservice, postApiCatalogPvtSkuservicetype, postApiCatalogPvtSkuservicetypeattachment, postApiCatalogPvtSkuservicevalue, postApiCatalogPvtSpecification, postApiCatalogPvtSpecificationvalue, postApiCatalogPvtStockkeepingunit, postApiCatalogPvtStockkeepingunitBySkuIdAttribute, postApiCatalogPvtStockkeepingunitBySkuIdEanByEan, postApiCatalogPvtStockkeepingunitBySkuIdFile, postApiCatalogPvtStockkeepingunitBySkuIdSpecification, postApiCatalogPvtStockkeepingunitkit, postApiCatalogPvtSubcollection, postApiCatalogPvtSubcollectionBySubCollectionIdBrand, postApiCatalogPvtSubcollectionBySubCollectionIdCategory, postApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalue, postApiCatalogPvtSubcollectionBySubCollectionIdStockkeepingunit, postApiCatalogPvtSupplier, postApiCatalogSystemPvtSkusellerChangenotificationBySellerIdBySellerSkuId, postCreateCollection, postRemoveproductsbyimportfile, productAndSkuIds, productandTradePolicy, productbyRefId, productVariations, putApiCatalogPvtAttachmentByAttachmentid, putApiCatalogPvtAttachmentByAttachmentIdLanguage, putApiCatalogPvtBrandByBrandId, putApiCatalogPvtBrandByBrandIdLanguage, putApiCatalogPvtCategoryByCategoryId, putApiCatalogPvtCategoryByCategoryIdLanguage, putApiCatalogPvtCollectionByCollectionId, putApiCatalogPvtCollectionByCollectionIdLanguage, putApiCatalogPvtProductByProductId, putApiCatalogPvtProductByProductIdLanguage, putApiCatalogPvtProductByProductIdSpecificationvalue, putApiCatalogPvtProductsByProductIdSpecificationBySpecificationIdLanguage, putApiCatalogPvtSkuserviceBySkuServiceId, putApiCatalogPvtSkuserviceBySkuserviceIdLanguage, putApiCatalogPvtSkuservicetypeBySkuServiceTypeId, putApiCatalogPvtSkuservicetypeBySkuServiceTypeIdLanguage, putApiCatalogPvtSkuservicevalueBySkuServiceValueId, putApiCatalogPvtSkuservicevalueBySkuServiceValueIdLanguage, putApiCatalogPvtSpecificationBySpecificationId, putApiCatalogPvtSpecificationBySpecificationIdLanguage, putApiCatalogPvtSpecificationgroupByGroupId, putApiCatalogPvtSpecificationgroupBySpecificationGroupIdLanguage, putApiCatalogPvtSpecificationvalueBySpecificationValueId, putApiCatalogPvtSpecificationvalueByValueIdLanguage, putApiCatalogPvtStockkeepingunitBySkuId, putApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeId, putApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdLanguage, putApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileId, putApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdLanguage, putApiCatalogPvtStockkeepingunitBySkuIdFileReorder, putApiCatalogPvtStockkeepingunitBySkuIdLanguage, putApiCatalogPvtStockkeepingunitBySkuIdSpecification, putApiCatalogPvtStockkeepingunitBySkuIdSpecificationvalue, putApiCatalogPvtStockkeepingunitCopyBySkuIdfromBySkuIdtoFile, putApiCatalogPvtSubcollectionBySubCollectionId, putApiCatalogPvtSupplierBySupplierId, salesChannelbyId, salesChannelList, sellerList, sku, skubyAlternateId, skubyEan, skuContext, skuIdbyRefId, skuIdlistbyRefIdlist, skulistbyProductId, specificationGroupInsert2, specificationsByCategoryId, specificationsField, specificationsGetFieldValue, specificationsGroupGet, specificationsGroupListbyCategory, specificationsInsertField, specificationsInsertFieldUpdate, specificationsInsertFieldValue, specificationsTreeByCategoryId, specificationsUpdateFieldValue, specificationsValuesByFieldId, updateProductSpecification, updateSeller } from './sdk.gen'; -export type { Accept, AlternateIds, AssociateattachmentstoSkuData, AssociateattachmentstoSkuResponses, Attachment, AttachmentId, AttachmentRequest, AttachmentResponse, BrandCreateUpdate, BrandCreateUpdateRequest, BrandData, BrandGet, BrandId, BrandListData, BrandListPerPageData, BrandListPerPageResponse, BrandListPerPageResponses, BrandListResponse, BrandListResponses, BrandResponse, BrandResponses, Category, CategoryId, CategorySpecification, CategoryTreeData, CategoryTreeResponse, CategoryTreeResponses, ChangeNotificationData, ChangeNotificationError, ChangeNotificationErrors, ChangeNotificationResponses, ClientOptions, CollectionId, ContentType, CreateCategoryRequest, CreateSellerData, CreateSellerRequest, CreateSellerResponse, CreateSellerResponses, CreateSkuComplementData, CreateSkuComplementResponse, CreateSkuComplementResponses, DeleteAllProductSpecificationsData, DeleteAllProductSpecificationsResponses, DeleteApiCatalogPvtAttachmentByAttachmentidData, DeleteApiCatalogPvtAttachmentByAttachmentidResponses, DeleteApiCatalogPvtBrandByBrandIdData, DeleteApiCatalogPvtBrandByBrandIdResponses, DeleteApiCatalogPvtCollectionByCollectionIdData, DeleteApiCatalogPvtCollectionByCollectionIdResponses, DeleteApiCatalogPvtProductByProductIdSalespolicyByTradepolicyIdData, DeleteApiCatalogPvtProductByProductIdSalespolicyByTradepolicyIdResponses, DeleteApiCatalogPvtProductByProductIdSimilarcategoryByCategoryIdData, DeleteApiCatalogPvtProductByProductIdSimilarcategoryByCategoryIdResponses, DeleteApiCatalogPvtSkuattachmentBySkuAttachmentAssociationIdData, DeleteApiCatalogPvtSkuattachmentBySkuAttachmentAssociationIdResponses, DeleteApiCatalogPvtSkuattachmentData, DeleteApiCatalogPvtSkuattachmentResponses, DeleteApiCatalogPvtSkuserviceBySkuServiceIdData, DeleteApiCatalogPvtSkuserviceBySkuServiceIdResponses, DeleteApiCatalogPvtSkuservicetypeattachmentBySkuServiceTypeAttachmentIdData, DeleteApiCatalogPvtSkuservicetypeattachmentBySkuServiceTypeAttachmentIdResponses, DeleteApiCatalogPvtSkuservicetypeattachmentData, DeleteApiCatalogPvtSkuservicetypeattachmentResponses, DeleteApiCatalogPvtSkuservicetypeBySkuServiceTypeIdData, DeleteApiCatalogPvtSkuservicetypeBySkuServiceTypeIdResponses, DeleteApiCatalogPvtSkuservicevalueBySkuServiceValueIdData, DeleteApiCatalogPvtSkuservicevalueBySkuServiceValueIdResponses, DeleteApiCatalogPvtSpecificationNonstructuredByIdData, DeleteApiCatalogPvtSpecificationNonstructuredByIdResponses, DeleteApiCatalogPvtSpecificationNonstructuredData, DeleteApiCatalogPvtSpecificationNonstructuredResponses, DeleteApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdData, DeleteApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdResponses, DeleteApiCatalogPvtStockkeepingunitBySkuIdAttributeData, DeleteApiCatalogPvtStockkeepingunitBySkuIdAttributeResponses, DeleteApiCatalogPvtStockkeepingunitBySkuIdEanByEanData, DeleteApiCatalogPvtStockkeepingunitBySkuIdEanByEanResponses, DeleteApiCatalogPvtStockkeepingunitBySkuIdEanData, DeleteApiCatalogPvtStockkeepingunitBySkuIdEanResponses, DeleteApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdData, DeleteApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdResponses, DeleteApiCatalogPvtStockkeepingunitBySkuIdFileData, DeleteApiCatalogPvtStockkeepingunitBySkuIdFileResponses, DeleteApiCatalogPvtStockkeepingunitBySkuIdSpecificationBySpecificationIdData, DeleteApiCatalogPvtStockkeepingunitBySkuIdSpecificationBySpecificationIdResponses, DeleteApiCatalogPvtStockkeepingunitBySkuIdSpecificationData, DeleteApiCatalogPvtStockkeepingunitBySkuIdSpecificationResponses, DeleteApiCatalogPvtStockkeepingunitDisassociateBySkuIdFileBySkuFileIdData, DeleteApiCatalogPvtStockkeepingunitDisassociateBySkuIdFileBySkuFileIdResponses, DeleteApiCatalogPvtStockkeepingunitkitByKitIdData, DeleteApiCatalogPvtStockkeepingunitkitByKitIdResponses, DeleteApiCatalogPvtStockkeepingunitkitData, DeleteApiCatalogPvtStockkeepingunitkitResponses, DeleteApiCatalogPvtSubcollectionBySubCollectionIdBrandByBrandIdData, DeleteApiCatalogPvtSubcollectionBySubCollectionIdBrandByBrandIdResponses, DeleteApiCatalogPvtSubcollectionBySubCollectionIdCategoryByCategoryIdData, DeleteApiCatalogPvtSubcollectionBySubCollectionIdCategoryByCategoryIdResponses, DeleteApiCatalogPvtSubcollectionBySubCollectionIdData, DeleteApiCatalogPvtSubcollectionBySubCollectionIdResponses, DeleteApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalueData, DeleteApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalueResponses, DeleteApiCatalogPvtSubcollectionBySubCollectionIdStockkeepingunitBySkuIdData, DeleteApiCatalogPvtSubcollectionBySubCollectionIdStockkeepingunitBySkuIdResponses, DeleteApiCatalogPvtSupplierBySupplierIdData, DeleteApiCatalogPvtSupplierBySupplierIdResponses, DeleteaProductSpecificationData, DeleteaProductSpecificationError, DeleteaProductSpecificationErrors, DeleteaProductSpecificationResponses, DeleteSkuComplementbySkuComplementIdData, DeleteSkuComplementbySkuComplementIdResponses, DeleteSkUsellerassociationData, DeleteSkUsellerassociationResponses, Dimension, GetAllCommercialConditionsData, GetAllCommercialConditionsResponse, GetAllCommercialConditionsResponses, GetAllInactiveCollectionsData, GetAllInactiveCollectionsResponse, GetAllInactiveCollectionsResponses, GetApiAddonPvtReviewGetProductRateByProductIdData, GetApiAddonPvtReviewGetProductRateByProductIdResponse, GetApiAddonPvtReviewGetProductRateByProductIdResponses, GetApiCatalogPvtAttachmentByAttachmentidData, GetApiCatalogPvtAttachmentByAttachmentIdLanguageData, GetApiCatalogPvtAttachmentByAttachmentIdLanguageErrors, GetApiCatalogPvtAttachmentByAttachmentIdLanguageResponse, GetApiCatalogPvtAttachmentByAttachmentIdLanguageResponses, GetApiCatalogPvtAttachmentByAttachmentidResponse, GetApiCatalogPvtAttachmentByAttachmentidResponses, GetApiCatalogPvtAttachmentsData, GetApiCatalogPvtAttachmentsResponse, GetApiCatalogPvtAttachmentsResponses, GetApiCatalogPvtBrandByBrandIdData, GetApiCatalogPvtBrandByBrandIdLanguageData, GetApiCatalogPvtBrandByBrandIdLanguageErrors, GetApiCatalogPvtBrandByBrandIdLanguageResponse, GetApiCatalogPvtBrandByBrandIdLanguageResponses, GetApiCatalogPvtBrandByBrandIdResponse, GetApiCatalogPvtBrandByBrandIdResponses, GetApiCatalogPvtCategoryByCategoryIdData, GetApiCatalogPvtCategoryByCategoryIdLanguageData, GetApiCatalogPvtCategoryByCategoryIdLanguageErrors, GetApiCatalogPvtCategoryByCategoryIdLanguageResponse, GetApiCatalogPvtCategoryByCategoryIdLanguageResponses, GetApiCatalogPvtCategoryByCategoryIdResponse, GetApiCatalogPvtCategoryByCategoryIdResponses, GetApiCatalogPvtCollectionByCollectionIdData, GetApiCatalogPvtCollectionByCollectionIdLanguageData, GetApiCatalogPvtCollectionByCollectionIdLanguageErrors, GetApiCatalogPvtCollectionByCollectionIdLanguageResponse, GetApiCatalogPvtCollectionByCollectionIdLanguageResponses, GetApiCatalogPvtCollectionByCollectionIdResponse, GetApiCatalogPvtCollectionByCollectionIdResponses, GetApiCatalogPvtCollectionByCollectionIdSubcollectionData, GetApiCatalogPvtCollectionByCollectionIdSubcollectionResponse, GetApiCatalogPvtCollectionByCollectionIdSubcollectionResponses, GetApiCatalogPvtProductByProductIdLanguageData, GetApiCatalogPvtProductByProductIdLanguageErrors, GetApiCatalogPvtProductByProductIdLanguageResponse, GetApiCatalogPvtProductByProductIdLanguageResponses, GetApiCatalogPvtProductByProductIdSalespolicyData, GetApiCatalogPvtProductByProductIdSalespolicyResponse, GetApiCatalogPvtProductByProductIdSalespolicyResponses, GetApiCatalogPvtProductByProductIdSimilarcategoryData, GetApiCatalogPvtProductByProductIdSimilarcategoryResponse, GetApiCatalogPvtProductByProductIdSimilarcategoryResponses, GetApiCatalogPvtProductsByProductIdSpecificationBySpecificationIdLanguageData, GetApiCatalogPvtProductsByProductIdSpecificationBySpecificationIdLanguageErrors, GetApiCatalogPvtProductsByProductIdSpecificationBySpecificationIdLanguageResponse, GetApiCatalogPvtProductsByProductIdSpecificationBySpecificationIdLanguageResponses, GetApiCatalogPvtSkuserviceBySkuServiceIdData, GetApiCatalogPvtSkuserviceBySkuserviceIdLanguageData, GetApiCatalogPvtSkuserviceBySkuserviceIdLanguageErrors, GetApiCatalogPvtSkuserviceBySkuserviceIdLanguageResponse, GetApiCatalogPvtSkuserviceBySkuserviceIdLanguageResponses, GetApiCatalogPvtSkuserviceBySkuServiceIdResponse, GetApiCatalogPvtSkuserviceBySkuServiceIdResponses, GetApiCatalogPvtSkuservicetypeBySkuServiceTypeIdData, GetApiCatalogPvtSkuservicetypeBySkuServiceTypeIdLanguageData, GetApiCatalogPvtSkuservicetypeBySkuServiceTypeIdLanguageErrors, GetApiCatalogPvtSkuservicetypeBySkuServiceTypeIdLanguageResponse, GetApiCatalogPvtSkuservicetypeBySkuServiceTypeIdLanguageResponses, GetApiCatalogPvtSkuservicetypeBySkuServiceTypeIdResponse, GetApiCatalogPvtSkuservicetypeBySkuServiceTypeIdResponses, GetApiCatalogPvtSkuservicevalueBySkuServiceValueIdData, GetApiCatalogPvtSkuservicevalueBySkuServiceValueIdLanguageData, GetApiCatalogPvtSkuservicevalueBySkuServiceValueIdLanguageErrors, GetApiCatalogPvtSkuservicevalueBySkuServiceValueIdLanguageResponse, GetApiCatalogPvtSkuservicevalueBySkuServiceValueIdLanguageResponses, GetApiCatalogPvtSkuservicevalueBySkuServiceValueIdResponse, GetApiCatalogPvtSkuservicevalueBySkuServiceValueIdResponses, GetApiCatalogPvtSpecificationBySpecificationIdData, GetApiCatalogPvtSpecificationBySpecificationIdLanguageData, GetApiCatalogPvtSpecificationBySpecificationIdLanguageErrors, GetApiCatalogPvtSpecificationBySpecificationIdLanguageResponse, GetApiCatalogPvtSpecificationBySpecificationIdLanguageResponses, GetApiCatalogPvtSpecificationBySpecificationIdResponse, GetApiCatalogPvtSpecificationBySpecificationIdResponses, GetApiCatalogPvtSpecificationgroupBySpecificationGroupIdLanguageData, GetApiCatalogPvtSpecificationgroupBySpecificationGroupIdLanguageErrors, GetApiCatalogPvtSpecificationgroupBySpecificationGroupIdLanguageResponse, GetApiCatalogPvtSpecificationgroupBySpecificationGroupIdLanguageResponses, GetApiCatalogPvtSpecificationNonstructuredByIdData, GetApiCatalogPvtSpecificationNonstructuredByIdResponse, GetApiCatalogPvtSpecificationNonstructuredByIdResponses, GetApiCatalogPvtSpecificationNonstructuredData, GetApiCatalogPvtSpecificationNonstructuredResponse, GetApiCatalogPvtSpecificationNonstructuredResponses, GetApiCatalogPvtSpecificationvalueBySpecificationValueIdData, GetApiCatalogPvtSpecificationvalueBySpecificationValueIdResponse, GetApiCatalogPvtSpecificationvalueBySpecificationValueIdResponses, GetApiCatalogPvtSpecificationvalueByValueIdLanguageData, GetApiCatalogPvtSpecificationvalueByValueIdLanguageErrors, GetApiCatalogPvtSpecificationvalueByValueIdLanguageResponse, GetApiCatalogPvtSpecificationvalueByValueIdLanguageResponses, GetApiCatalogPvtStockkeepingunitBySkuIdAttachmentData, GetApiCatalogPvtStockkeepingunitBySkuIdAttachmentResponse, GetApiCatalogPvtStockkeepingunitBySkuIdAttachmentResponses, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdData, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdLanguageData, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdLanguageErrors, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdLanguageResponse, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdLanguageResponses, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdResponse, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdResponses, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeData, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeResponse, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeResponses, GetApiCatalogPvtStockkeepingunitBySkuIdEanData, GetApiCatalogPvtStockkeepingunitBySkuIdEanResponse, GetApiCatalogPvtStockkeepingunitBySkuIdEanResponses, GetApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdLanguageData, GetApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdLanguageErrors, GetApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdLanguageResponse, GetApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdLanguageResponses, GetApiCatalogPvtStockkeepingunitBySkuIdFileData, GetApiCatalogPvtStockkeepingunitBySkuIdFileResponse, GetApiCatalogPvtStockkeepingunitBySkuIdFileResponses, GetApiCatalogPvtStockkeepingunitBySkuIdLanguageData, GetApiCatalogPvtStockkeepingunitBySkuIdLanguageErrors, GetApiCatalogPvtStockkeepingunitBySkuIdLanguageResponse, GetApiCatalogPvtStockkeepingunitBySkuIdLanguageResponses, GetApiCatalogPvtStockkeepingunitBySkuIdSpecificationData, GetApiCatalogPvtStockkeepingunitBySkuIdSpecificationResponse, GetApiCatalogPvtStockkeepingunitBySkuIdSpecificationResponses, GetApiCatalogPvtStockkeepingunitData, GetApiCatalogPvtStockkeepingunitkitByKitIdData, GetApiCatalogPvtStockkeepingunitkitByKitIdResponse, GetApiCatalogPvtStockkeepingunitkitByKitIdResponses, GetApiCatalogPvtStockkeepingunitkitData, GetApiCatalogPvtStockkeepingunitkitResponse, GetApiCatalogPvtStockkeepingunitkitResponses, GetApiCatalogPvtStockkeepingunitResponse, GetApiCatalogPvtStockkeepingunitResponses, GetApiCatalogPvtSubcollectionBySubCollectionIdData, GetApiCatalogPvtSubcollectionBySubCollectionIdResponse, GetApiCatalogPvtSubcollectionBySubCollectionIdResponses, GetApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalueData, GetApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalueResponse, GetApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalueResponses, GetApiCatalogSystemPvtSkuStockkeepingunitidsbysaleschannelData, GetApiCatalogSystemPvtSkuStockkeepingunitidsbysaleschannelResponse, GetApiCatalogSystemPvtSkuStockkeepingunitidsbysaleschannelResponses, GetCategoryTree, GetCategoryTreeChild, GetCommercialConditionsData, GetCommercialConditionsResponse, GetCommercialConditionsResponses, GetGiftListData, GetGiftListResponse, GetGiftListResponses, GetImportfileexampleData, GetImportfileexampleResponse, GetImportfileexampleResponses, GetorUpdateProductSpecification, GetProductbyidData, GetProductbyidResponse, GetProductbyidResponses, GetProductsfromacollectionData, GetProductsfromacollectionResponse, GetProductsfromacollectionResponses, GetProductSpecificationbyProductIdData, GetProductSpecificationbyProductIdResponse, GetProductSpecificationbyProductIdResponses, GetProductSpecificationData, GetProductSpecificationResponse, GetProductSpecificationResponses, GetSellerbyIdData, GetSellerbyIdResponse, GetSellerbyIdResponses, GetSellersbyIdData, GetSellersbyIdResponse, GetSellersbyIdResponses, GetSkuAltId, GetSkUandContext, GetSkuComplementbySkuComplementIdData, GetSkuComplementbySkuComplementIdResponse, GetSkuComplementbySkuComplementIdResponses, GetSkuComplementbySkuidData, GetSkuComplementbySkuidResponse, GetSkuComplementbySkuidResponses, GetSkuComplementsbyComplementTypeIdData, GetSkuComplementsbyComplementTypeIdResponse, GetSkuComplementsbyComplementTypeIdResponses, GetSkUcomplementsbytypeData, GetSkUcomplementsbytypeResponse, GetSkUcomplementsbytypeResponses, GetSkUsellerData, GetSkUsellerResponse, GetSkUsellerResponses, Image, IndexedInfoData, IndexedInfoResponse, IndexedInfoResponses, ListallSkuidsData, ListallSkuidsResponse, ListallSkuidsResponses, Locale, PostAddproductsbyimportfileData, PostAddproductsbyimportfileResponses, PostApiCatalogPvtAttachmentData, PostApiCatalogPvtAttachmentResponse, PostApiCatalogPvtAttachmentResponses, PostApiCatalogPvtBrandData, PostApiCatalogPvtBrandResponse, PostApiCatalogPvtBrandResponses, PostApiCatalogPvtCategoryData, PostApiCatalogPvtCategoryResponse, PostApiCatalogPvtCategoryResponses, PostApiCatalogPvtCollectionByCollectionIdPositionData, PostApiCatalogPvtCollectionByCollectionIdPositionResponses, PostApiCatalogPvtProductByProductIdSalespolicyByTradepolicyIdData, PostApiCatalogPvtProductByProductIdSalespolicyByTradepolicyIdResponses, PostApiCatalogPvtProductByProductIdSimilarcategoryByCategoryIdData, PostApiCatalogPvtProductByProductIdSimilarcategoryByCategoryIdResponse, PostApiCatalogPvtProductByProductIdSimilarcategoryByCategoryIdResponses, PostApiCatalogPvtProductByProductIdSpecificationData, PostApiCatalogPvtProductByProductIdSpecificationResponse, PostApiCatalogPvtProductByProductIdSpecificationResponses, PostApiCatalogPvtProductData, PostApiCatalogPvtProductResponse, PostApiCatalogPvtProductResponses, PostApiCatalogPvtSkuattachmentData, PostApiCatalogPvtSkuattachmentResponse, PostApiCatalogPvtSkuattachmentResponses, PostApiCatalogPvtSkuserviceData, PostApiCatalogPvtSkuserviceResponse, PostApiCatalogPvtSkuserviceResponses, PostApiCatalogPvtSkuservicetypeattachmentData, PostApiCatalogPvtSkuservicetypeattachmentResponse, PostApiCatalogPvtSkuservicetypeattachmentResponses, PostApiCatalogPvtSkuservicetypeData, PostApiCatalogPvtSkuservicetypeResponse, PostApiCatalogPvtSkuservicetypeResponses, PostApiCatalogPvtSkuservicevalueData, PostApiCatalogPvtSkuservicevalueResponse, PostApiCatalogPvtSkuservicevalueResponses, PostApiCatalogPvtSpecificationData, PostApiCatalogPvtSpecificationResponse, PostApiCatalogPvtSpecificationResponses, PostApiCatalogPvtSpecificationvalueData, PostApiCatalogPvtSpecificationvalueResponse, PostApiCatalogPvtSpecificationvalueResponses, PostApiCatalogPvtStockkeepingunitBySkuIdAttributeData, PostApiCatalogPvtStockkeepingunitBySkuIdAttributeError, PostApiCatalogPvtStockkeepingunitBySkuIdAttributeErrors, PostApiCatalogPvtStockkeepingunitBySkuIdAttributeResponse, PostApiCatalogPvtStockkeepingunitBySkuIdAttributeResponses, PostApiCatalogPvtStockkeepingunitBySkuIdEanByEanData, PostApiCatalogPvtStockkeepingunitBySkuIdEanByEanResponses, PostApiCatalogPvtStockkeepingunitBySkuIdFileData, PostApiCatalogPvtStockkeepingunitBySkuIdFileResponse, PostApiCatalogPvtStockkeepingunitBySkuIdFileResponses, PostApiCatalogPvtStockkeepingunitBySkuIdSpecificationData, PostApiCatalogPvtStockkeepingunitBySkuIdSpecificationResponse, PostApiCatalogPvtStockkeepingunitBySkuIdSpecificationResponses, PostApiCatalogPvtStockkeepingunitData, PostApiCatalogPvtStockkeepingunitkitData, PostApiCatalogPvtStockkeepingunitkitResponse, PostApiCatalogPvtStockkeepingunitkitResponses, PostApiCatalogPvtStockkeepingunitResponse, PostApiCatalogPvtStockkeepingunitResponses, PostApiCatalogPvtSubcollectionBySubCollectionIdBrandData, PostApiCatalogPvtSubcollectionBySubCollectionIdBrandResponse, PostApiCatalogPvtSubcollectionBySubCollectionIdBrandResponses, PostApiCatalogPvtSubcollectionBySubCollectionIdCategoryData, PostApiCatalogPvtSubcollectionBySubCollectionIdCategoryResponse, PostApiCatalogPvtSubcollectionBySubCollectionIdCategoryResponses, PostApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalueData, PostApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalueResponse, PostApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalueResponses, PostApiCatalogPvtSubcollectionBySubCollectionIdStockkeepingunitData, PostApiCatalogPvtSubcollectionBySubCollectionIdStockkeepingunitResponse, PostApiCatalogPvtSubcollectionBySubCollectionIdStockkeepingunitResponses, PostApiCatalogPvtSubcollectionData, PostApiCatalogPvtSubcollectionResponse, PostApiCatalogPvtSubcollectionResponses, PostApiCatalogPvtSupplierData, PostApiCatalogPvtSupplierResponse, PostApiCatalogPvtSupplierResponses, PostApiCatalogSystemPvtSkusellerChangenotificationBySellerIdBySellerSkuIdData, PostApiCatalogSystemPvtSkusellerChangenotificationBySellerIdBySellerSkuIdResponse, PostApiCatalogSystemPvtSkusellerChangenotificationBySellerIdBySellerSkuIdResponses, PostCreateCollectionData, PostCreateCollectionResponse, PostCreateCollectionResponses, PostRemoveproductsbyimportfileData, PostRemoveproductsbyimportfileResponses, ProductAndSkuIdsData, ProductAndSkuIdsResponse, ProductAndSkuIdsResponses, ProductandTradePolicyData, ProductandTradePolicyResponse, ProductandTradePolicyResponses, ProductbyRefIdData, ProductbyRefIdResponse, ProductbyRefIdResponses, ProductId, ProductSpecification, ProductVariationsData, ProductVariationsResponse, ProductVariationsResponses, PutApiCatalogPvtAttachmentByAttachmentidData, PutApiCatalogPvtAttachmentByAttachmentIdLanguageData, PutApiCatalogPvtAttachmentByAttachmentIdLanguageErrors, PutApiCatalogPvtAttachmentByAttachmentIdLanguageResponses, PutApiCatalogPvtAttachmentByAttachmentidResponse, PutApiCatalogPvtAttachmentByAttachmentidResponses, PutApiCatalogPvtBrandByBrandIdData, PutApiCatalogPvtBrandByBrandIdLanguageData, PutApiCatalogPvtBrandByBrandIdLanguageErrors, PutApiCatalogPvtBrandByBrandIdLanguageResponses, PutApiCatalogPvtBrandByBrandIdResponse, PutApiCatalogPvtBrandByBrandIdResponses, PutApiCatalogPvtCategoryByCategoryIdData, PutApiCatalogPvtCategoryByCategoryIdLanguageData, PutApiCatalogPvtCategoryByCategoryIdLanguageErrors, PutApiCatalogPvtCategoryByCategoryIdLanguageResponses, PutApiCatalogPvtCategoryByCategoryIdResponse, PutApiCatalogPvtCategoryByCategoryIdResponses, PutApiCatalogPvtCollectionByCollectionIdData, PutApiCatalogPvtCollectionByCollectionIdLanguageData, PutApiCatalogPvtCollectionByCollectionIdLanguageErrors, PutApiCatalogPvtCollectionByCollectionIdLanguageResponses, PutApiCatalogPvtCollectionByCollectionIdResponse, PutApiCatalogPvtCollectionByCollectionIdResponses, PutApiCatalogPvtProductByProductIdData, PutApiCatalogPvtProductByProductIdLanguageData, PutApiCatalogPvtProductByProductIdLanguageErrors, PutApiCatalogPvtProductByProductIdLanguageResponses, PutApiCatalogPvtProductByProductIdResponse, PutApiCatalogPvtProductByProductIdResponses, PutApiCatalogPvtProductByProductIdSpecificationvalueData, PutApiCatalogPvtProductByProductIdSpecificationvalueResponse, PutApiCatalogPvtProductByProductIdSpecificationvalueResponses, PutApiCatalogPvtProductsByProductIdSpecificationBySpecificationIdLanguageData, PutApiCatalogPvtProductsByProductIdSpecificationBySpecificationIdLanguageErrors, PutApiCatalogPvtProductsByProductIdSpecificationBySpecificationIdLanguageResponses, PutApiCatalogPvtSkuserviceBySkuServiceIdData, PutApiCatalogPvtSkuserviceBySkuserviceIdLanguageData, PutApiCatalogPvtSkuserviceBySkuserviceIdLanguageErrors, PutApiCatalogPvtSkuserviceBySkuserviceIdLanguageResponses, PutApiCatalogPvtSkuserviceBySkuServiceIdResponse, PutApiCatalogPvtSkuserviceBySkuServiceIdResponses, PutApiCatalogPvtSkuservicetypeBySkuServiceTypeIdData, PutApiCatalogPvtSkuservicetypeBySkuServiceTypeIdLanguageData, PutApiCatalogPvtSkuservicetypeBySkuServiceTypeIdLanguageErrors, PutApiCatalogPvtSkuservicetypeBySkuServiceTypeIdLanguageResponses, PutApiCatalogPvtSkuservicetypeBySkuServiceTypeIdResponse, PutApiCatalogPvtSkuservicetypeBySkuServiceTypeIdResponses, PutApiCatalogPvtSkuservicevalueBySkuServiceValueIdData, PutApiCatalogPvtSkuservicevalueBySkuServiceValueIdLanguageData, PutApiCatalogPvtSkuservicevalueBySkuServiceValueIdLanguageErrors, PutApiCatalogPvtSkuservicevalueBySkuServiceValueIdLanguageResponses, PutApiCatalogPvtSkuservicevalueBySkuServiceValueIdResponse, PutApiCatalogPvtSkuservicevalueBySkuServiceValueIdResponses, PutApiCatalogPvtSpecificationBySpecificationIdData, PutApiCatalogPvtSpecificationBySpecificationIdLanguageData, PutApiCatalogPvtSpecificationBySpecificationIdLanguageErrors, PutApiCatalogPvtSpecificationBySpecificationIdLanguageResponses, PutApiCatalogPvtSpecificationBySpecificationIdResponse, PutApiCatalogPvtSpecificationBySpecificationIdResponses, PutApiCatalogPvtSpecificationgroupByGroupIdData, PutApiCatalogPvtSpecificationgroupByGroupIdResponse, PutApiCatalogPvtSpecificationgroupByGroupIdResponses, PutApiCatalogPvtSpecificationgroupBySpecificationGroupIdLanguageData, PutApiCatalogPvtSpecificationgroupBySpecificationGroupIdLanguageErrors, PutApiCatalogPvtSpecificationgroupBySpecificationGroupIdLanguageResponses, PutApiCatalogPvtSpecificationvalueBySpecificationValueIdData, PutApiCatalogPvtSpecificationvalueBySpecificationValueIdResponse, PutApiCatalogPvtSpecificationvalueBySpecificationValueIdResponses, PutApiCatalogPvtSpecificationvalueByValueIdLanguageData, PutApiCatalogPvtSpecificationvalueByValueIdLanguageErrors, PutApiCatalogPvtSpecificationvalueByValueIdLanguageResponses, PutApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdData, PutApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdError, PutApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdErrors, PutApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdLanguageData, PutApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdLanguageErrors, PutApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdLanguageResponses, PutApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdResponse, PutApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdResponses, PutApiCatalogPvtStockkeepingunitBySkuIdData, PutApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdData, PutApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdLanguageData, PutApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdLanguageErrors, PutApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdLanguageResponses, PutApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdResponse, PutApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdResponses, PutApiCatalogPvtStockkeepingunitBySkuIdFileReorderData, PutApiCatalogPvtStockkeepingunitBySkuIdFileReorderErrors, PutApiCatalogPvtStockkeepingunitBySkuIdFileReorderResponses, PutApiCatalogPvtStockkeepingunitBySkuIdLanguageData, PutApiCatalogPvtStockkeepingunitBySkuIdLanguageErrors, PutApiCatalogPvtStockkeepingunitBySkuIdLanguageResponses, PutApiCatalogPvtStockkeepingunitBySkuIdResponse, PutApiCatalogPvtStockkeepingunitBySkuIdResponses, PutApiCatalogPvtStockkeepingunitBySkuIdSpecificationData, PutApiCatalogPvtStockkeepingunitBySkuIdSpecificationResponse, PutApiCatalogPvtStockkeepingunitBySkuIdSpecificationResponses, PutApiCatalogPvtStockkeepingunitBySkuIdSpecificationvalueData, PutApiCatalogPvtStockkeepingunitBySkuIdSpecificationvalueResponse, PutApiCatalogPvtStockkeepingunitBySkuIdSpecificationvalueResponses, PutApiCatalogPvtStockkeepingunitCopyBySkuIdfromBySkuIdtoFileData, PutApiCatalogPvtStockkeepingunitCopyBySkuIdfromBySkuIdtoFileResponse, PutApiCatalogPvtStockkeepingunitCopyBySkuIdfromBySkuIdtoFileResponses, PutApiCatalogPvtSubcollectionBySubCollectionIdData, PutApiCatalogPvtSubcollectionBySubCollectionIdResponse, PutApiCatalogPvtSubcollectionBySubCollectionIdResponses, PutApiCatalogPvtSupplierBySupplierIdData, PutApiCatalogPvtSupplierBySupplierIdResponse, PutApiCatalogPvtSupplierBySupplierIdResponses, RealDimension, SalesChannelbyIdData, SalesChannelbyIdResponse, SalesChannelbyIdResponses, SalesChannelListData, SalesChannelListResponse, SalesChannelListResponses, SellerListData, SellerListResponse, SellerListResponses, SkuAttributeId, SkubyAlternateIdData, SkubyAlternateIdResponse, SkubyAlternateIdResponses, SkubyEanData, SkubyEanResponse, SkubyEanResponses, SkuComplement, SkuContextData, SkuContextResponse, SkuContextResponses, SkuData, SkuFile, SkuFileId, SkuFileResponse, SkuFileUrl, SkuId, SkuIdbyRefIdData, SkuIdbyRefIdResponse, SkuIdbyRefIdResponses, SkuIdlistbyRefIdlistData, SkuIdlistbyRefIdlistErrors, SkuIdlistbyRefIdlistResponse, SkuIdlistbyRefIdlistResponses, SkuKit, SkulistbyProductId, SkulistbyProductIdData, SkulistbyProductIdResponse, SkulistbyProductIdResponses, SkuResponse, SkuResponses, SkuSeller, SkuService, SkuServiceId, SkuServiceTypeId, SkuServiceTypeRequest, SkuServiceTypeResponse, SkuServiceValueId, SkuServiceValueRequest, SkuServiceValueResponse, SkuSpecification, SkuSpecificationResponse, SpecificationGroupId, SpecificationGroupInsert2Data, SpecificationGroupInsert2Response, SpecificationGroupInsert2Responses, SpecificationId, SpecificationsByCategoryIdData, SpecificationsByCategoryIdResponse, SpecificationsByCategoryIdResponses, SpecificationsFieldData, SpecificationsFieldResponse, SpecificationsFieldResponses, SpecificationsGetFieldValueData, SpecificationsGetFieldValueResponse, SpecificationsGetFieldValueResponses, SpecificationsGroup, SpecificationsGroupGetData, SpecificationsGroupGetResponse, SpecificationsGroupGetResponses, SpecificationsGroupListbyCategoryData, SpecificationsGroupListbyCategoryResponse, SpecificationsGroupListbyCategoryResponses, SpecificationsInsertFieldData, SpecificationsInsertFieldResponse, SpecificationsInsertFieldResponses, SpecificationsInsertFieldUpdateData, SpecificationsInsertFieldUpdateResponse, SpecificationsInsertFieldUpdateResponses, SpecificationsInsertFieldValueData, SpecificationsInsertFieldValueResponse, SpecificationsInsertFieldValueResponses, SpecificationsTreeByCategoryIdData, SpecificationsTreeByCategoryIdResponse, SpecificationsTreeByCategoryIdResponses, SpecificationsUpdateFieldValueData, SpecificationsUpdateFieldValueResponse, SpecificationsUpdateFieldValueResponses, SpecificationsValuesByFieldIdData, SpecificationsValuesByFieldIdResponse, SpecificationsValuesByFieldIdResponses, SpecificationValuesSubcollectionIdResponse, SubCollectionId, SupplierRequest, SupplierResponse, UpdateProductSpecificationData, UpdateProductSpecificationResponses, UpdateSellerData, UpdateSellerRequest, UpdateSellerResponse, UpdateSellerResponses, ValueId } from './types.gen'; +export { associateattachmentstoSku, brand, brandList, brandListPerPage, categoryTree, changeNotification, createSeller, createSkuComplement, deleteAllProductSpecifications, deleteApiCatalogPvtAssortmentByProductAssortmentId, deleteApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionId, deleteApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionId, deleteApiCatalogPvtAttachmentByAttachmentid, deleteApiCatalogPvtBrandByBrandId, deleteApiCatalogPvtCollectionByCollectionId, deleteApiCatalogPvtProductByProductIdSalespolicyByTradepolicyId, deleteApiCatalogPvtProductByProductIdSimilarcategoryByCategoryId, deleteApiCatalogPvtSkuattachment, deleteApiCatalogPvtSkuattachmentBySkuAttachmentAssociationId, deleteApiCatalogPvtSkuserviceBySkuServiceId, deleteApiCatalogPvtSkuservicetypeattachment, deleteApiCatalogPvtSkuservicetypeattachmentBySkuServiceTypeAttachmentId, deleteApiCatalogPvtSkuservicetypeBySkuServiceTypeId, deleteApiCatalogPvtSkuservicevalueBySkuServiceValueId, deleteApiCatalogPvtSpecificationNonstructured, deleteApiCatalogPvtSpecificationNonstructuredById, deleteApiCatalogPvtStockkeepingunitBySkuIdAttribute, deleteApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeId, deleteApiCatalogPvtStockkeepingunitBySkuIdEan, deleteApiCatalogPvtStockkeepingunitBySkuIdEanByEan, deleteApiCatalogPvtStockkeepingunitBySkuIdFile, deleteApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileId, deleteApiCatalogPvtStockkeepingunitBySkuIdSpecification, deleteApiCatalogPvtStockkeepingunitBySkuIdSpecificationBySpecificationId, deleteApiCatalogPvtStockkeepingunitDisassociateBySkuIdFileBySkuFileId, deleteApiCatalogPvtStockkeepingunitkit, deleteApiCatalogPvtStockkeepingunitkitByKitId, deleteApiCatalogPvtSubcollectionBySubCollectionId, deleteApiCatalogPvtSubcollectionBySubCollectionIdBrandByBrandId, deleteApiCatalogPvtSubcollectionBySubCollectionIdCategoryByCategoryId, deleteApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalue, deleteApiCatalogPvtSubcollectionBySubCollectionIdStockkeepingunitBySkuId, deleteApiCatalogPvtSupplierBySupplierId, deleteaProductSpecification, deleteSkuComplementbySkuComplementId, deleteSkUsellerassociation, getAllCommercialConditions, getAllInactiveCollections, getApiAddonPvtReviewGetProductRateByProductId, getApiCatalogPvtAssortment, getApiCatalogPvtAssortmentByProductAssortmentId, getApiCatalogPvtAttachmentByAttachmentid, getApiCatalogPvtAttachmentByAttachmentIdLanguage, getApiCatalogPvtAttachments, getApiCatalogPvtBrandByBrandId, getApiCatalogPvtBrandByBrandIdLanguage, getApiCatalogPvtCategoryByCategoryId, getApiCatalogPvtCategoryByCategoryIdLanguage, getApiCatalogPvtCollectionByCollectionId, getApiCatalogPvtCollectionByCollectionIdLanguage, getApiCatalogPvtCollectionByCollectionIdSubcollection, getApiCatalogPvtProductByProductIdLanguage, getApiCatalogPvtProductByProductIdSalespolicy, getApiCatalogPvtProductByProductIdSimilarcategory, getApiCatalogPvtProductsByProductIdSpecificationBySpecificationIdLanguage, getApiCatalogPvtSkuserviceBySkuServiceId, getApiCatalogPvtSkuserviceBySkuserviceIdLanguage, getApiCatalogPvtSkuservicetypeBySkuServiceTypeId, getApiCatalogPvtSkuservicetypeBySkuServiceTypeIdLanguage, getApiCatalogPvtSkuservicevalueBySkuServiceValueId, getApiCatalogPvtSkuservicevalueBySkuServiceValueIdLanguage, getApiCatalogPvtSpecificationBySpecificationId, getApiCatalogPvtSpecificationBySpecificationIdLanguage, getApiCatalogPvtSpecificationgroupBySpecificationGroupIdLanguage, getApiCatalogPvtSpecificationNonstructured, getApiCatalogPvtSpecificationNonstructuredById, getApiCatalogPvtSpecificationvalueBySpecificationValueId, getApiCatalogPvtSpecificationvalueByValueIdLanguage, getApiCatalogPvtStockkeepingunit, getApiCatalogPvtStockkeepingunitBySkuIdAttachment, getApiCatalogPvtStockkeepingunitBySkuIdAttribute, getApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeId, getApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdLanguage, getApiCatalogPvtStockkeepingunitBySkuIdEan, getApiCatalogPvtStockkeepingunitBySkuIdFile, getApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdLanguage, getApiCatalogPvtStockkeepingunitBySkuIdLanguage, getApiCatalogPvtStockkeepingunitBySkuIdSpecification, getApiCatalogPvtStockkeepingunitkit, getApiCatalogPvtStockkeepingunitkitByKitId, getApiCatalogPvtSubcollectionBySubCollectionId, getApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalue, getApiCatalogSystemPvtSkuStockkeepingunitidsbysaleschannel, getCommercialConditions, getGiftList, getImportfileexample, getProductbyid, getProductsfromacollection, getProductSpecification, getProductSpecificationbyProductId, getSellerbyId, getSellersbyId, getSkuComplementbySkuComplementId, getSkuComplementbySkuid, getSkuComplementsbyComplementTypeId, getSkUcomplementsbytype, getSkUseller, indexedInfo, listallSkuids, type Options, postAddproductsbyimportfile, postApiCatalogPvtAssortment, postApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionId, postApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionId, postApiCatalogPvtAttachment, postApiCatalogPvtBrand, postApiCatalogPvtCategory, postApiCatalogPvtCollectionByCollectionIdPosition, postApiCatalogPvtProduct, postApiCatalogPvtProductByProductIdSalespolicyByTradepolicyId, postApiCatalogPvtProductByProductIdSimilarcategoryByCategoryId, postApiCatalogPvtProductByProductIdSpecification, postApiCatalogPvtSkuattachment, postApiCatalogPvtSkuservice, postApiCatalogPvtSkuservicetype, postApiCatalogPvtSkuservicetypeattachment, postApiCatalogPvtSkuservicevalue, postApiCatalogPvtSpecification, postApiCatalogPvtSpecificationvalue, postApiCatalogPvtStockkeepingunit, postApiCatalogPvtStockkeepingunitBySkuIdAttribute, postApiCatalogPvtStockkeepingunitBySkuIdEanByEan, postApiCatalogPvtStockkeepingunitBySkuIdFile, postApiCatalogPvtStockkeepingunitBySkuIdSpecification, postApiCatalogPvtStockkeepingunitkit, postApiCatalogPvtSubcollection, postApiCatalogPvtSubcollectionBySubCollectionIdBrand, postApiCatalogPvtSubcollectionBySubCollectionIdCategory, postApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalue, postApiCatalogPvtSubcollectionBySubCollectionIdStockkeepingunit, postApiCatalogPvtSupplier, postApiCatalogSystemPvtSkusellerChangenotificationBySellerIdBySellerSkuId, postCreateCollection, postRemoveproductsbyimportfile, productAndSkuIds, productandTradePolicy, productbyRefId, productVariations, putApiCatalogPvtAssortmentByProductAssortmentId, putApiCatalogPvtAttachmentByAttachmentid, putApiCatalogPvtAttachmentByAttachmentIdLanguage, putApiCatalogPvtBrandByBrandId, putApiCatalogPvtBrandByBrandIdLanguage, putApiCatalogPvtCategoryByCategoryId, putApiCatalogPvtCategoryByCategoryIdLanguage, putApiCatalogPvtCollectionByCollectionId, putApiCatalogPvtCollectionByCollectionIdLanguage, putApiCatalogPvtProductByProductId, putApiCatalogPvtProductByProductIdLanguage, putApiCatalogPvtProductByProductIdSpecificationvalue, putApiCatalogPvtProductsByProductIdSpecificationBySpecificationIdLanguage, putApiCatalogPvtSkuserviceBySkuServiceId, putApiCatalogPvtSkuserviceBySkuserviceIdLanguage, putApiCatalogPvtSkuservicetypeBySkuServiceTypeId, putApiCatalogPvtSkuservicetypeBySkuServiceTypeIdLanguage, putApiCatalogPvtSkuservicevalueBySkuServiceValueId, putApiCatalogPvtSkuservicevalueBySkuServiceValueIdLanguage, putApiCatalogPvtSpecificationBySpecificationId, putApiCatalogPvtSpecificationBySpecificationIdLanguage, putApiCatalogPvtSpecificationgroupByGroupId, putApiCatalogPvtSpecificationgroupBySpecificationGroupIdLanguage, putApiCatalogPvtSpecificationvalueBySpecificationValueId, putApiCatalogPvtSpecificationvalueByValueIdLanguage, putApiCatalogPvtStockkeepingunitBySkuId, putApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeId, putApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdLanguage, putApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileId, putApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdLanguage, putApiCatalogPvtStockkeepingunitBySkuIdFileReorder, putApiCatalogPvtStockkeepingunitBySkuIdLanguage, putApiCatalogPvtStockkeepingunitBySkuIdSpecification, putApiCatalogPvtStockkeepingunitBySkuIdSpecificationvalue, putApiCatalogPvtStockkeepingunitCopyBySkuIdfromBySkuIdtoFile, putApiCatalogPvtSubcollectionBySubCollectionId, putApiCatalogPvtSupplierBySupplierId, salesChannelbyId, salesChannelList, sellerList, sku, skubyAlternateId, skubyEan, skuContext, skuIdbyRefId, skuIdlistbyRefIdlist, skulistbyProductId, specificationGroupInsert2, specificationsByCategoryId, specificationsField, specificationsGetFieldValue, specificationsGroupGet, specificationsGroupListbyCategory, specificationsInsertField, specificationsInsertFieldUpdate, specificationsInsertFieldValue, specificationsTreeByCategoryId, specificationsUpdateFieldValue, specificationsValuesByFieldId, updateProductSpecification, updateSeller } from './sdk.gen'; +export type { Accept, AlternateIds, AssociateattachmentstoSkuData, AssociateattachmentstoSkuResponses, AssortmentCollectionAssociation, Attachment, AttachmentId, AttachmentRequest, AttachmentResponse, BrandCreateUpdate, BrandCreateUpdateRequest, BrandData, BrandGet, BrandId, BrandListData, BrandListPerPageData, BrandListPerPageResponse, BrandListPerPageResponses, BrandListResponse, BrandListResponses, BrandResponse, BrandResponses, Category, CategoryId, CategorySpecification, CategoryTreeData, CategoryTreeResponse, CategoryTreeResponses, ChangeNotificationData, ChangeNotificationError, ChangeNotificationErrors, ChangeNotificationResponses, ClientOptions, CollectionId, CollectionId2, ContentType, CreateCategoryRequest, CreateSellerData, CreateSellerRequest, CreateSellerResponse, CreateSellerResponses, CreateSkuComplementData, CreateSkuComplementResponse, CreateSkuComplementResponses, DeleteAllProductSpecificationsData, DeleteAllProductSpecificationsResponses, DeleteApiCatalogPvtAssortmentByProductAssortmentIdData, DeleteApiCatalogPvtAssortmentByProductAssortmentIdError, DeleteApiCatalogPvtAssortmentByProductAssortmentIdErrors, DeleteApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdData, DeleteApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdError, DeleteApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdErrors, DeleteApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdResponse, DeleteApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdResponses, DeleteApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdData, DeleteApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdError, DeleteApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdErrors, DeleteApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdResponse, DeleteApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdResponses, DeleteApiCatalogPvtAssortmentByProductAssortmentIdResponse, DeleteApiCatalogPvtAssortmentByProductAssortmentIdResponses, DeleteApiCatalogPvtAttachmentByAttachmentidData, DeleteApiCatalogPvtAttachmentByAttachmentidResponses, DeleteApiCatalogPvtBrandByBrandIdData, DeleteApiCatalogPvtBrandByBrandIdResponses, DeleteApiCatalogPvtCollectionByCollectionIdData, DeleteApiCatalogPvtCollectionByCollectionIdResponses, DeleteApiCatalogPvtProductByProductIdSalespolicyByTradepolicyIdData, DeleteApiCatalogPvtProductByProductIdSalespolicyByTradepolicyIdResponses, DeleteApiCatalogPvtProductByProductIdSimilarcategoryByCategoryIdData, DeleteApiCatalogPvtProductByProductIdSimilarcategoryByCategoryIdResponses, DeleteApiCatalogPvtSkuattachmentBySkuAttachmentAssociationIdData, DeleteApiCatalogPvtSkuattachmentBySkuAttachmentAssociationIdResponses, DeleteApiCatalogPvtSkuattachmentData, DeleteApiCatalogPvtSkuattachmentResponses, DeleteApiCatalogPvtSkuserviceBySkuServiceIdData, DeleteApiCatalogPvtSkuserviceBySkuServiceIdResponses, DeleteApiCatalogPvtSkuservicetypeattachmentBySkuServiceTypeAttachmentIdData, DeleteApiCatalogPvtSkuservicetypeattachmentBySkuServiceTypeAttachmentIdResponses, DeleteApiCatalogPvtSkuservicetypeattachmentData, DeleteApiCatalogPvtSkuservicetypeattachmentResponses, DeleteApiCatalogPvtSkuservicetypeBySkuServiceTypeIdData, DeleteApiCatalogPvtSkuservicetypeBySkuServiceTypeIdResponses, DeleteApiCatalogPvtSkuservicevalueBySkuServiceValueIdData, DeleteApiCatalogPvtSkuservicevalueBySkuServiceValueIdResponses, DeleteApiCatalogPvtSpecificationNonstructuredByIdData, DeleteApiCatalogPvtSpecificationNonstructuredByIdResponses, DeleteApiCatalogPvtSpecificationNonstructuredData, DeleteApiCatalogPvtSpecificationNonstructuredResponses, DeleteApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdData, DeleteApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdResponses, DeleteApiCatalogPvtStockkeepingunitBySkuIdAttributeData, DeleteApiCatalogPvtStockkeepingunitBySkuIdAttributeResponses, DeleteApiCatalogPvtStockkeepingunitBySkuIdEanByEanData, DeleteApiCatalogPvtStockkeepingunitBySkuIdEanByEanResponses, DeleteApiCatalogPvtStockkeepingunitBySkuIdEanData, DeleteApiCatalogPvtStockkeepingunitBySkuIdEanResponses, DeleteApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdData, DeleteApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdResponses, DeleteApiCatalogPvtStockkeepingunitBySkuIdFileData, DeleteApiCatalogPvtStockkeepingunitBySkuIdFileResponses, DeleteApiCatalogPvtStockkeepingunitBySkuIdSpecificationBySpecificationIdData, DeleteApiCatalogPvtStockkeepingunitBySkuIdSpecificationBySpecificationIdResponses, DeleteApiCatalogPvtStockkeepingunitBySkuIdSpecificationData, DeleteApiCatalogPvtStockkeepingunitBySkuIdSpecificationResponses, DeleteApiCatalogPvtStockkeepingunitDisassociateBySkuIdFileBySkuFileIdData, DeleteApiCatalogPvtStockkeepingunitDisassociateBySkuIdFileBySkuFileIdResponses, DeleteApiCatalogPvtStockkeepingunitkitByKitIdData, DeleteApiCatalogPvtStockkeepingunitkitByKitIdResponses, DeleteApiCatalogPvtStockkeepingunitkitData, DeleteApiCatalogPvtStockkeepingunitkitResponses, DeleteApiCatalogPvtSubcollectionBySubCollectionIdBrandByBrandIdData, DeleteApiCatalogPvtSubcollectionBySubCollectionIdBrandByBrandIdResponses, DeleteApiCatalogPvtSubcollectionBySubCollectionIdCategoryByCategoryIdData, DeleteApiCatalogPvtSubcollectionBySubCollectionIdCategoryByCategoryIdResponses, DeleteApiCatalogPvtSubcollectionBySubCollectionIdData, DeleteApiCatalogPvtSubcollectionBySubCollectionIdResponses, DeleteApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalueData, DeleteApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalueResponses, DeleteApiCatalogPvtSubcollectionBySubCollectionIdStockkeepingunitBySkuIdData, DeleteApiCatalogPvtSubcollectionBySubCollectionIdStockkeepingunitBySkuIdResponses, DeleteApiCatalogPvtSupplierBySupplierIdData, DeleteApiCatalogPvtSupplierBySupplierIdResponses, DeleteaProductSpecificationData, DeleteaProductSpecificationError, DeleteaProductSpecificationErrors, DeleteaProductSpecificationResponses, DeleteSkuComplementbySkuComplementIdData, DeleteSkuComplementbySkuComplementIdResponses, DeleteSkUsellerassociationData, DeleteSkUsellerassociationResponses, Dimension, ErrorResponse, GetAllCommercialConditionsData, GetAllCommercialConditionsResponse, GetAllCommercialConditionsResponses, GetAllInactiveCollectionsData, GetAllInactiveCollectionsResponse, GetAllInactiveCollectionsResponses, GetApiAddonPvtReviewGetProductRateByProductIdData, GetApiAddonPvtReviewGetProductRateByProductIdResponse, GetApiAddonPvtReviewGetProductRateByProductIdResponses, GetApiCatalogPvtAssortmentByProductAssortmentIdData, GetApiCatalogPvtAssortmentByProductAssortmentIdError, GetApiCatalogPvtAssortmentByProductAssortmentIdErrors, GetApiCatalogPvtAssortmentByProductAssortmentIdResponse, GetApiCatalogPvtAssortmentByProductAssortmentIdResponses, GetApiCatalogPvtAssortmentData, GetApiCatalogPvtAssortmentResponse, GetApiCatalogPvtAssortmentResponses, GetApiCatalogPvtAttachmentByAttachmentidData, GetApiCatalogPvtAttachmentByAttachmentIdLanguageData, GetApiCatalogPvtAttachmentByAttachmentIdLanguageErrors, GetApiCatalogPvtAttachmentByAttachmentIdLanguageResponse, GetApiCatalogPvtAttachmentByAttachmentIdLanguageResponses, GetApiCatalogPvtAttachmentByAttachmentidResponse, GetApiCatalogPvtAttachmentByAttachmentidResponses, GetApiCatalogPvtAttachmentsData, GetApiCatalogPvtAttachmentsResponse, GetApiCatalogPvtAttachmentsResponses, GetApiCatalogPvtBrandByBrandIdData, GetApiCatalogPvtBrandByBrandIdLanguageData, GetApiCatalogPvtBrandByBrandIdLanguageErrors, GetApiCatalogPvtBrandByBrandIdLanguageResponse, GetApiCatalogPvtBrandByBrandIdLanguageResponses, GetApiCatalogPvtBrandByBrandIdResponse, GetApiCatalogPvtBrandByBrandIdResponses, GetApiCatalogPvtCategoryByCategoryIdData, GetApiCatalogPvtCategoryByCategoryIdLanguageData, GetApiCatalogPvtCategoryByCategoryIdLanguageErrors, GetApiCatalogPvtCategoryByCategoryIdLanguageResponse, GetApiCatalogPvtCategoryByCategoryIdLanguageResponses, GetApiCatalogPvtCategoryByCategoryIdResponse, GetApiCatalogPvtCategoryByCategoryIdResponses, GetApiCatalogPvtCollectionByCollectionIdData, GetApiCatalogPvtCollectionByCollectionIdLanguageData, GetApiCatalogPvtCollectionByCollectionIdLanguageErrors, GetApiCatalogPvtCollectionByCollectionIdLanguageResponse, GetApiCatalogPvtCollectionByCollectionIdLanguageResponses, GetApiCatalogPvtCollectionByCollectionIdResponse, GetApiCatalogPvtCollectionByCollectionIdResponses, GetApiCatalogPvtCollectionByCollectionIdSubcollectionData, GetApiCatalogPvtCollectionByCollectionIdSubcollectionResponse, GetApiCatalogPvtCollectionByCollectionIdSubcollectionResponses, GetApiCatalogPvtProductByProductIdLanguageData, GetApiCatalogPvtProductByProductIdLanguageErrors, GetApiCatalogPvtProductByProductIdLanguageResponse, GetApiCatalogPvtProductByProductIdLanguageResponses, GetApiCatalogPvtProductByProductIdSalespolicyData, GetApiCatalogPvtProductByProductIdSalespolicyResponse, GetApiCatalogPvtProductByProductIdSalespolicyResponses, GetApiCatalogPvtProductByProductIdSimilarcategoryData, GetApiCatalogPvtProductByProductIdSimilarcategoryResponse, GetApiCatalogPvtProductByProductIdSimilarcategoryResponses, GetApiCatalogPvtProductsByProductIdSpecificationBySpecificationIdLanguageData, GetApiCatalogPvtProductsByProductIdSpecificationBySpecificationIdLanguageErrors, GetApiCatalogPvtProductsByProductIdSpecificationBySpecificationIdLanguageResponse, GetApiCatalogPvtProductsByProductIdSpecificationBySpecificationIdLanguageResponses, GetApiCatalogPvtSkuserviceBySkuServiceIdData, GetApiCatalogPvtSkuserviceBySkuserviceIdLanguageData, GetApiCatalogPvtSkuserviceBySkuserviceIdLanguageErrors, GetApiCatalogPvtSkuserviceBySkuserviceIdLanguageResponse, GetApiCatalogPvtSkuserviceBySkuserviceIdLanguageResponses, GetApiCatalogPvtSkuserviceBySkuServiceIdResponse, GetApiCatalogPvtSkuserviceBySkuServiceIdResponses, GetApiCatalogPvtSkuservicetypeBySkuServiceTypeIdData, GetApiCatalogPvtSkuservicetypeBySkuServiceTypeIdLanguageData, GetApiCatalogPvtSkuservicetypeBySkuServiceTypeIdLanguageErrors, GetApiCatalogPvtSkuservicetypeBySkuServiceTypeIdLanguageResponse, GetApiCatalogPvtSkuservicetypeBySkuServiceTypeIdLanguageResponses, GetApiCatalogPvtSkuservicetypeBySkuServiceTypeIdResponse, GetApiCatalogPvtSkuservicetypeBySkuServiceTypeIdResponses, GetApiCatalogPvtSkuservicevalueBySkuServiceValueIdData, GetApiCatalogPvtSkuservicevalueBySkuServiceValueIdLanguageData, GetApiCatalogPvtSkuservicevalueBySkuServiceValueIdLanguageErrors, GetApiCatalogPvtSkuservicevalueBySkuServiceValueIdLanguageResponse, GetApiCatalogPvtSkuservicevalueBySkuServiceValueIdLanguageResponses, GetApiCatalogPvtSkuservicevalueBySkuServiceValueIdResponse, GetApiCatalogPvtSkuservicevalueBySkuServiceValueIdResponses, GetApiCatalogPvtSpecificationBySpecificationIdData, GetApiCatalogPvtSpecificationBySpecificationIdLanguageData, GetApiCatalogPvtSpecificationBySpecificationIdLanguageErrors, GetApiCatalogPvtSpecificationBySpecificationIdLanguageResponse, GetApiCatalogPvtSpecificationBySpecificationIdLanguageResponses, GetApiCatalogPvtSpecificationBySpecificationIdResponse, GetApiCatalogPvtSpecificationBySpecificationIdResponses, GetApiCatalogPvtSpecificationgroupBySpecificationGroupIdLanguageData, GetApiCatalogPvtSpecificationgroupBySpecificationGroupIdLanguageErrors, GetApiCatalogPvtSpecificationgroupBySpecificationGroupIdLanguageResponse, GetApiCatalogPvtSpecificationgroupBySpecificationGroupIdLanguageResponses, GetApiCatalogPvtSpecificationNonstructuredByIdData, GetApiCatalogPvtSpecificationNonstructuredByIdResponse, GetApiCatalogPvtSpecificationNonstructuredByIdResponses, GetApiCatalogPvtSpecificationNonstructuredData, GetApiCatalogPvtSpecificationNonstructuredResponse, GetApiCatalogPvtSpecificationNonstructuredResponses, GetApiCatalogPvtSpecificationvalueBySpecificationValueIdData, GetApiCatalogPvtSpecificationvalueBySpecificationValueIdResponse, GetApiCatalogPvtSpecificationvalueBySpecificationValueIdResponses, GetApiCatalogPvtSpecificationvalueByValueIdLanguageData, GetApiCatalogPvtSpecificationvalueByValueIdLanguageErrors, GetApiCatalogPvtSpecificationvalueByValueIdLanguageResponse, GetApiCatalogPvtSpecificationvalueByValueIdLanguageResponses, GetApiCatalogPvtStockkeepingunitBySkuIdAttachmentData, GetApiCatalogPvtStockkeepingunitBySkuIdAttachmentResponse, GetApiCatalogPvtStockkeepingunitBySkuIdAttachmentResponses, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdData, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdLanguageData, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdLanguageErrors, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdLanguageResponse, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdLanguageResponses, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdResponse, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdResponses, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeData, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeResponse, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeResponses, GetApiCatalogPvtStockkeepingunitBySkuIdEanData, GetApiCatalogPvtStockkeepingunitBySkuIdEanResponse, GetApiCatalogPvtStockkeepingunitBySkuIdEanResponses, GetApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdLanguageData, GetApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdLanguageErrors, GetApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdLanguageResponse, GetApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdLanguageResponses, GetApiCatalogPvtStockkeepingunitBySkuIdFileData, GetApiCatalogPvtStockkeepingunitBySkuIdFileResponse, GetApiCatalogPvtStockkeepingunitBySkuIdFileResponses, GetApiCatalogPvtStockkeepingunitBySkuIdLanguageData, GetApiCatalogPvtStockkeepingunitBySkuIdLanguageErrors, GetApiCatalogPvtStockkeepingunitBySkuIdLanguageResponse, GetApiCatalogPvtStockkeepingunitBySkuIdLanguageResponses, GetApiCatalogPvtStockkeepingunitBySkuIdSpecificationData, GetApiCatalogPvtStockkeepingunitBySkuIdSpecificationResponse, GetApiCatalogPvtStockkeepingunitBySkuIdSpecificationResponses, GetApiCatalogPvtStockkeepingunitData, GetApiCatalogPvtStockkeepingunitkitByKitIdData, GetApiCatalogPvtStockkeepingunitkitByKitIdResponse, GetApiCatalogPvtStockkeepingunitkitByKitIdResponses, GetApiCatalogPvtStockkeepingunitkitData, GetApiCatalogPvtStockkeepingunitkitResponse, GetApiCatalogPvtStockkeepingunitkitResponses, GetApiCatalogPvtStockkeepingunitResponse, GetApiCatalogPvtStockkeepingunitResponses, GetApiCatalogPvtSubcollectionBySubCollectionIdData, GetApiCatalogPvtSubcollectionBySubCollectionIdResponse, GetApiCatalogPvtSubcollectionBySubCollectionIdResponses, GetApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalueData, GetApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalueResponse, GetApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalueResponses, GetApiCatalogSystemPvtSkuStockkeepingunitidsbysaleschannelData, GetApiCatalogSystemPvtSkuStockkeepingunitidsbysaleschannelResponse, GetApiCatalogSystemPvtSkuStockkeepingunitidsbysaleschannelResponses, GetCategoryTree, GetCategoryTreeChild, GetCommercialConditionsData, GetCommercialConditionsResponse, GetCommercialConditionsResponses, GetGiftListData, GetGiftListResponse, GetGiftListResponses, GetImportfileexampleData, GetImportfileexampleResponse, GetImportfileexampleResponses, GetorUpdateProductSpecification, GetProductbyidData, GetProductbyidResponse, GetProductbyidResponses, GetProductsfromacollectionData, GetProductsfromacollectionResponse, GetProductsfromacollectionResponses, GetProductSpecificationbyProductIdData, GetProductSpecificationbyProductIdResponse, GetProductSpecificationbyProductIdResponses, GetProductSpecificationData, GetProductSpecificationResponse, GetProductSpecificationResponses, GetSellerbyIdData, GetSellerbyIdResponse, GetSellerbyIdResponses, GetSellersbyIdData, GetSellersbyIdResponse, GetSellersbyIdResponses, GetSkuAltId, GetSkUandContext, GetSkuComplementbySkuComplementIdData, GetSkuComplementbySkuComplementIdResponse, GetSkuComplementbySkuComplementIdResponses, GetSkuComplementbySkuidData, GetSkuComplementbySkuidResponse, GetSkuComplementbySkuidResponses, GetSkuComplementsbyComplementTypeIdData, GetSkuComplementsbyComplementTypeIdResponse, GetSkuComplementsbyComplementTypeIdResponses, GetSkUcomplementsbytypeData, GetSkUcomplementsbytypeResponse, GetSkUcomplementsbytypeResponses, GetSkUsellerData, GetSkUsellerResponse, GetSkUsellerResponses, Image, IndexedInfoData, IndexedInfoResponse, IndexedInfoResponses, ListallSkuidsData, ListallSkuidsResponse, ListallSkuidsResponses, Locale, PostAddproductsbyimportfileData, PostAddproductsbyimportfileResponses, PostApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdData, PostApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdError, PostApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdErrors, PostApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdResponse, PostApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdResponses, PostApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdData, PostApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdError, PostApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdErrors, PostApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdResponse, PostApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdResponses, PostApiCatalogPvtAssortmentData, PostApiCatalogPvtAssortmentError, PostApiCatalogPvtAssortmentErrors, PostApiCatalogPvtAssortmentResponse, PostApiCatalogPvtAssortmentResponses, PostApiCatalogPvtAttachmentData, PostApiCatalogPvtAttachmentResponse, PostApiCatalogPvtAttachmentResponses, PostApiCatalogPvtBrandData, PostApiCatalogPvtBrandResponse, PostApiCatalogPvtBrandResponses, PostApiCatalogPvtCategoryData, PostApiCatalogPvtCategoryResponse, PostApiCatalogPvtCategoryResponses, PostApiCatalogPvtCollectionByCollectionIdPositionData, PostApiCatalogPvtCollectionByCollectionIdPositionResponses, PostApiCatalogPvtProductByProductIdSalespolicyByTradepolicyIdData, PostApiCatalogPvtProductByProductIdSalespolicyByTradepolicyIdResponses, PostApiCatalogPvtProductByProductIdSimilarcategoryByCategoryIdData, PostApiCatalogPvtProductByProductIdSimilarcategoryByCategoryIdResponse, PostApiCatalogPvtProductByProductIdSimilarcategoryByCategoryIdResponses, PostApiCatalogPvtProductByProductIdSpecificationData, PostApiCatalogPvtProductByProductIdSpecificationResponse, PostApiCatalogPvtProductByProductIdSpecificationResponses, PostApiCatalogPvtProductData, PostApiCatalogPvtProductResponse, PostApiCatalogPvtProductResponses, PostApiCatalogPvtSkuattachmentData, PostApiCatalogPvtSkuattachmentResponse, PostApiCatalogPvtSkuattachmentResponses, PostApiCatalogPvtSkuserviceData, PostApiCatalogPvtSkuserviceResponse, PostApiCatalogPvtSkuserviceResponses, PostApiCatalogPvtSkuservicetypeattachmentData, PostApiCatalogPvtSkuservicetypeattachmentResponse, PostApiCatalogPvtSkuservicetypeattachmentResponses, PostApiCatalogPvtSkuservicetypeData, PostApiCatalogPvtSkuservicetypeResponse, PostApiCatalogPvtSkuservicetypeResponses, PostApiCatalogPvtSkuservicevalueData, PostApiCatalogPvtSkuservicevalueResponse, PostApiCatalogPvtSkuservicevalueResponses, PostApiCatalogPvtSpecificationData, PostApiCatalogPvtSpecificationResponse, PostApiCatalogPvtSpecificationResponses, PostApiCatalogPvtSpecificationvalueData, PostApiCatalogPvtSpecificationvalueResponse, PostApiCatalogPvtSpecificationvalueResponses, PostApiCatalogPvtStockkeepingunitBySkuIdAttributeData, PostApiCatalogPvtStockkeepingunitBySkuIdAttributeError, PostApiCatalogPvtStockkeepingunitBySkuIdAttributeErrors, PostApiCatalogPvtStockkeepingunitBySkuIdAttributeResponse, PostApiCatalogPvtStockkeepingunitBySkuIdAttributeResponses, PostApiCatalogPvtStockkeepingunitBySkuIdEanByEanData, PostApiCatalogPvtStockkeepingunitBySkuIdEanByEanResponses, PostApiCatalogPvtStockkeepingunitBySkuIdFileData, PostApiCatalogPvtStockkeepingunitBySkuIdFileResponse, PostApiCatalogPvtStockkeepingunitBySkuIdFileResponses, PostApiCatalogPvtStockkeepingunitBySkuIdSpecificationData, PostApiCatalogPvtStockkeepingunitBySkuIdSpecificationResponse, PostApiCatalogPvtStockkeepingunitBySkuIdSpecificationResponses, PostApiCatalogPvtStockkeepingunitData, PostApiCatalogPvtStockkeepingunitkitData, PostApiCatalogPvtStockkeepingunitkitResponse, PostApiCatalogPvtStockkeepingunitkitResponses, PostApiCatalogPvtStockkeepingunitResponse, PostApiCatalogPvtStockkeepingunitResponses, PostApiCatalogPvtSubcollectionBySubCollectionIdBrandData, PostApiCatalogPvtSubcollectionBySubCollectionIdBrandResponse, PostApiCatalogPvtSubcollectionBySubCollectionIdBrandResponses, PostApiCatalogPvtSubcollectionBySubCollectionIdCategoryData, PostApiCatalogPvtSubcollectionBySubCollectionIdCategoryResponse, PostApiCatalogPvtSubcollectionBySubCollectionIdCategoryResponses, PostApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalueData, PostApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalueResponse, PostApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalueResponses, PostApiCatalogPvtSubcollectionBySubCollectionIdStockkeepingunitData, PostApiCatalogPvtSubcollectionBySubCollectionIdStockkeepingunitResponse, PostApiCatalogPvtSubcollectionBySubCollectionIdStockkeepingunitResponses, PostApiCatalogPvtSubcollectionData, PostApiCatalogPvtSubcollectionResponse, PostApiCatalogPvtSubcollectionResponses, PostApiCatalogPvtSupplierData, PostApiCatalogPvtSupplierResponse, PostApiCatalogPvtSupplierResponses, PostApiCatalogSystemPvtSkusellerChangenotificationBySellerIdBySellerSkuIdData, PostApiCatalogSystemPvtSkusellerChangenotificationBySellerIdBySellerSkuIdResponse, PostApiCatalogSystemPvtSkusellerChangenotificationBySellerIdBySellerSkuIdResponses, PostCreateCollectionData, PostCreateCollectionResponse, PostCreateCollectionResponses, PostRemoveproductsbyimportfileData, PostRemoveproductsbyimportfileResponses, ProductAndSkuIdsData, ProductAndSkuIdsResponse, ProductAndSkuIdsResponses, ProductandTradePolicyData, ProductandTradePolicyResponse, ProductandTradePolicyResponses, ProductAssortment, ProductAssortmentId, ProductbyRefIdData, ProductbyRefIdResponse, ProductbyRefIdResponses, ProductId, ProductSpecification, ProductVariationsData, ProductVariationsResponse, ProductVariationsResponses, PutApiCatalogPvtAssortmentByProductAssortmentIdData, PutApiCatalogPvtAssortmentByProductAssortmentIdError, PutApiCatalogPvtAssortmentByProductAssortmentIdErrors, PutApiCatalogPvtAssortmentByProductAssortmentIdResponse, PutApiCatalogPvtAssortmentByProductAssortmentIdResponses, PutApiCatalogPvtAttachmentByAttachmentidData, PutApiCatalogPvtAttachmentByAttachmentIdLanguageData, PutApiCatalogPvtAttachmentByAttachmentIdLanguageErrors, PutApiCatalogPvtAttachmentByAttachmentIdLanguageResponses, PutApiCatalogPvtAttachmentByAttachmentidResponse, PutApiCatalogPvtAttachmentByAttachmentidResponses, PutApiCatalogPvtBrandByBrandIdData, PutApiCatalogPvtBrandByBrandIdLanguageData, PutApiCatalogPvtBrandByBrandIdLanguageErrors, PutApiCatalogPvtBrandByBrandIdLanguageResponses, PutApiCatalogPvtBrandByBrandIdResponse, PutApiCatalogPvtBrandByBrandIdResponses, PutApiCatalogPvtCategoryByCategoryIdData, PutApiCatalogPvtCategoryByCategoryIdLanguageData, PutApiCatalogPvtCategoryByCategoryIdLanguageErrors, PutApiCatalogPvtCategoryByCategoryIdLanguageResponses, PutApiCatalogPvtCategoryByCategoryIdResponse, PutApiCatalogPvtCategoryByCategoryIdResponses, PutApiCatalogPvtCollectionByCollectionIdData, PutApiCatalogPvtCollectionByCollectionIdLanguageData, PutApiCatalogPvtCollectionByCollectionIdLanguageErrors, PutApiCatalogPvtCollectionByCollectionIdLanguageResponses, PutApiCatalogPvtCollectionByCollectionIdResponse, PutApiCatalogPvtCollectionByCollectionIdResponses, PutApiCatalogPvtProductByProductIdData, PutApiCatalogPvtProductByProductIdLanguageData, PutApiCatalogPvtProductByProductIdLanguageErrors, PutApiCatalogPvtProductByProductIdLanguageResponses, PutApiCatalogPvtProductByProductIdResponse, PutApiCatalogPvtProductByProductIdResponses, PutApiCatalogPvtProductByProductIdSpecificationvalueData, PutApiCatalogPvtProductByProductIdSpecificationvalueResponse, PutApiCatalogPvtProductByProductIdSpecificationvalueResponses, PutApiCatalogPvtProductsByProductIdSpecificationBySpecificationIdLanguageData, PutApiCatalogPvtProductsByProductIdSpecificationBySpecificationIdLanguageErrors, PutApiCatalogPvtProductsByProductIdSpecificationBySpecificationIdLanguageResponses, PutApiCatalogPvtSkuserviceBySkuServiceIdData, PutApiCatalogPvtSkuserviceBySkuserviceIdLanguageData, PutApiCatalogPvtSkuserviceBySkuserviceIdLanguageErrors, PutApiCatalogPvtSkuserviceBySkuserviceIdLanguageResponses, PutApiCatalogPvtSkuserviceBySkuServiceIdResponse, PutApiCatalogPvtSkuserviceBySkuServiceIdResponses, PutApiCatalogPvtSkuservicetypeBySkuServiceTypeIdData, PutApiCatalogPvtSkuservicetypeBySkuServiceTypeIdLanguageData, PutApiCatalogPvtSkuservicetypeBySkuServiceTypeIdLanguageErrors, PutApiCatalogPvtSkuservicetypeBySkuServiceTypeIdLanguageResponses, PutApiCatalogPvtSkuservicetypeBySkuServiceTypeIdResponse, PutApiCatalogPvtSkuservicetypeBySkuServiceTypeIdResponses, PutApiCatalogPvtSkuservicevalueBySkuServiceValueIdData, PutApiCatalogPvtSkuservicevalueBySkuServiceValueIdLanguageData, PutApiCatalogPvtSkuservicevalueBySkuServiceValueIdLanguageErrors, PutApiCatalogPvtSkuservicevalueBySkuServiceValueIdLanguageResponses, PutApiCatalogPvtSkuservicevalueBySkuServiceValueIdResponse, PutApiCatalogPvtSkuservicevalueBySkuServiceValueIdResponses, PutApiCatalogPvtSpecificationBySpecificationIdData, PutApiCatalogPvtSpecificationBySpecificationIdLanguageData, PutApiCatalogPvtSpecificationBySpecificationIdLanguageErrors, PutApiCatalogPvtSpecificationBySpecificationIdLanguageResponses, PutApiCatalogPvtSpecificationBySpecificationIdResponse, PutApiCatalogPvtSpecificationBySpecificationIdResponses, PutApiCatalogPvtSpecificationgroupByGroupIdData, PutApiCatalogPvtSpecificationgroupByGroupIdResponse, PutApiCatalogPvtSpecificationgroupByGroupIdResponses, PutApiCatalogPvtSpecificationgroupBySpecificationGroupIdLanguageData, PutApiCatalogPvtSpecificationgroupBySpecificationGroupIdLanguageErrors, PutApiCatalogPvtSpecificationgroupBySpecificationGroupIdLanguageResponses, PutApiCatalogPvtSpecificationvalueBySpecificationValueIdData, PutApiCatalogPvtSpecificationvalueBySpecificationValueIdResponse, PutApiCatalogPvtSpecificationvalueBySpecificationValueIdResponses, PutApiCatalogPvtSpecificationvalueByValueIdLanguageData, PutApiCatalogPvtSpecificationvalueByValueIdLanguageErrors, PutApiCatalogPvtSpecificationvalueByValueIdLanguageResponses, PutApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdData, PutApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdError, PutApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdErrors, PutApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdLanguageData, PutApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdLanguageErrors, PutApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdLanguageResponses, PutApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdResponse, PutApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdResponses, PutApiCatalogPvtStockkeepingunitBySkuIdData, PutApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdData, PutApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdLanguageData, PutApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdLanguageErrors, PutApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdLanguageResponses, PutApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdResponse, PutApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdResponses, PutApiCatalogPvtStockkeepingunitBySkuIdFileReorderData, PutApiCatalogPvtStockkeepingunitBySkuIdFileReorderErrors, PutApiCatalogPvtStockkeepingunitBySkuIdFileReorderResponses, PutApiCatalogPvtStockkeepingunitBySkuIdLanguageData, PutApiCatalogPvtStockkeepingunitBySkuIdLanguageErrors, PutApiCatalogPvtStockkeepingunitBySkuIdLanguageResponses, PutApiCatalogPvtStockkeepingunitBySkuIdResponse, PutApiCatalogPvtStockkeepingunitBySkuIdResponses, PutApiCatalogPvtStockkeepingunitBySkuIdSpecificationData, PutApiCatalogPvtStockkeepingunitBySkuIdSpecificationResponse, PutApiCatalogPvtStockkeepingunitBySkuIdSpecificationResponses, PutApiCatalogPvtStockkeepingunitBySkuIdSpecificationvalueData, PutApiCatalogPvtStockkeepingunitBySkuIdSpecificationvalueResponse, PutApiCatalogPvtStockkeepingunitBySkuIdSpecificationvalueResponses, PutApiCatalogPvtStockkeepingunitCopyBySkuIdfromBySkuIdtoFileData, PutApiCatalogPvtStockkeepingunitCopyBySkuIdfromBySkuIdtoFileResponse, PutApiCatalogPvtStockkeepingunitCopyBySkuIdfromBySkuIdtoFileResponses, PutApiCatalogPvtSubcollectionBySubCollectionIdData, PutApiCatalogPvtSubcollectionBySubCollectionIdResponse, PutApiCatalogPvtSubcollectionBySubCollectionIdResponses, PutApiCatalogPvtSupplierBySupplierIdData, PutApiCatalogPvtSupplierBySupplierIdResponse, PutApiCatalogPvtSupplierBySupplierIdResponses, RealDimension, SalesChannelbyIdData, SalesChannelbyIdResponse, SalesChannelbyIdResponses, SalesChannelListData, SalesChannelListResponse, SalesChannelListResponses, SellerListData, SellerListResponse, SellerListResponses, SkuAttributeId, SkubyAlternateIdData, SkubyAlternateIdResponse, SkubyAlternateIdResponses, SkubyEanData, SkubyEanResponse, SkubyEanResponses, SkuComplement, SkuContextData, SkuContextResponse, SkuContextResponses, SkuData, SkuFile, SkuFileId, SkuFileResponse, SkuFileUrl, SkuId, SkuIdbyRefIdData, SkuIdbyRefIdResponse, SkuIdbyRefIdResponses, SkuIdlistbyRefIdlistData, SkuIdlistbyRefIdlistErrors, SkuIdlistbyRefIdlistResponse, SkuIdlistbyRefIdlistResponses, SkuKit, SkulistbyProductId, SkulistbyProductIdData, SkulistbyProductIdResponse, SkulistbyProductIdResponses, SkuResponse, SkuResponses, SkuSeller, SkuService, SkuServiceId, SkuServiceTypeId, SkuServiceTypeRequest, SkuServiceTypeResponse, SkuServiceValueId, SkuServiceValueRequest, SkuServiceValueResponse, SkuSpecification, SkuSpecificationResponse, SpecificationGroupId, SpecificationGroupInsert2Data, SpecificationGroupInsert2Response, SpecificationGroupInsert2Responses, SpecificationId, SpecificationsByCategoryIdData, SpecificationsByCategoryIdResponse, SpecificationsByCategoryIdResponses, SpecificationsFieldData, SpecificationsFieldResponse, SpecificationsFieldResponses, SpecificationsGetFieldValueData, SpecificationsGetFieldValueResponse, SpecificationsGetFieldValueResponses, SpecificationsGroup, SpecificationsGroupGetData, SpecificationsGroupGetResponse, SpecificationsGroupGetResponses, SpecificationsGroupListbyCategoryData, SpecificationsGroupListbyCategoryResponse, SpecificationsGroupListbyCategoryResponses, SpecificationsInsertFieldData, SpecificationsInsertFieldResponse, SpecificationsInsertFieldResponses, SpecificationsInsertFieldUpdateData, SpecificationsInsertFieldUpdateResponse, SpecificationsInsertFieldUpdateResponses, SpecificationsInsertFieldValueData, SpecificationsInsertFieldValueResponse, SpecificationsInsertFieldValueResponses, SpecificationsTreeByCategoryIdData, SpecificationsTreeByCategoryIdResponse, SpecificationsTreeByCategoryIdResponses, SpecificationsUpdateFieldValueData, SpecificationsUpdateFieldValueResponse, SpecificationsUpdateFieldValueResponses, SpecificationsValuesByFieldIdData, SpecificationsValuesByFieldIdResponse, SpecificationsValuesByFieldIdResponses, SpecificationValuesSubcollectionIdResponse, SubCollectionId, SupplierRequest, SupplierResponse, UpdateProductSpecificationData, UpdateProductSpecificationResponses, UpdateSellerData, UpdateSellerRequest, UpdateSellerResponse, UpdateSellerResponses, ValueId } from './types.gen'; diff --git a/vtex/server/generated/catalog/sdk.gen.ts b/vtex/server/generated/catalog/sdk.gen.ts index 5dc7d2e0..0dd2b4b8 100644 --- a/vtex/server/generated/catalog/sdk.gen.ts +++ b/vtex/server/generated/catalog/sdk.gen.ts @@ -2,7 +2,7 @@ import { type Client, formDataBodySerializer, type Options as Options2, type TDataShape } from './client'; import { client } from './client.gen'; -import type { AssociateattachmentstoSkuData, AssociateattachmentstoSkuResponses, BrandData, BrandListData, BrandListPerPageData, BrandListPerPageResponses, BrandListResponses, BrandResponses, CategoryTreeData, CategoryTreeResponses, ChangeNotificationData, ChangeNotificationErrors, ChangeNotificationResponses, CreateSellerData, CreateSellerResponses, CreateSkuComplementData, CreateSkuComplementResponses, DeleteAllProductSpecificationsData, DeleteAllProductSpecificationsResponses, DeleteApiCatalogPvtAttachmentByAttachmentidData, DeleteApiCatalogPvtAttachmentByAttachmentidResponses, DeleteApiCatalogPvtBrandByBrandIdData, DeleteApiCatalogPvtBrandByBrandIdResponses, DeleteApiCatalogPvtCollectionByCollectionIdData, DeleteApiCatalogPvtCollectionByCollectionIdResponses, DeleteApiCatalogPvtProductByProductIdSalespolicyByTradepolicyIdData, DeleteApiCatalogPvtProductByProductIdSalespolicyByTradepolicyIdResponses, DeleteApiCatalogPvtProductByProductIdSimilarcategoryByCategoryIdData, DeleteApiCatalogPvtProductByProductIdSimilarcategoryByCategoryIdResponses, DeleteApiCatalogPvtSkuattachmentBySkuAttachmentAssociationIdData, DeleteApiCatalogPvtSkuattachmentBySkuAttachmentAssociationIdResponses, DeleteApiCatalogPvtSkuattachmentData, DeleteApiCatalogPvtSkuattachmentResponses, DeleteApiCatalogPvtSkuserviceBySkuServiceIdData, DeleteApiCatalogPvtSkuserviceBySkuServiceIdResponses, DeleteApiCatalogPvtSkuservicetypeattachmentBySkuServiceTypeAttachmentIdData, DeleteApiCatalogPvtSkuservicetypeattachmentBySkuServiceTypeAttachmentIdResponses, DeleteApiCatalogPvtSkuservicetypeattachmentData, DeleteApiCatalogPvtSkuservicetypeattachmentResponses, DeleteApiCatalogPvtSkuservicetypeBySkuServiceTypeIdData, DeleteApiCatalogPvtSkuservicetypeBySkuServiceTypeIdResponses, DeleteApiCatalogPvtSkuservicevalueBySkuServiceValueIdData, DeleteApiCatalogPvtSkuservicevalueBySkuServiceValueIdResponses, DeleteApiCatalogPvtSpecificationNonstructuredByIdData, DeleteApiCatalogPvtSpecificationNonstructuredByIdResponses, DeleteApiCatalogPvtSpecificationNonstructuredData, DeleteApiCatalogPvtSpecificationNonstructuredResponses, DeleteApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdData, DeleteApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdResponses, DeleteApiCatalogPvtStockkeepingunitBySkuIdAttributeData, DeleteApiCatalogPvtStockkeepingunitBySkuIdAttributeResponses, DeleteApiCatalogPvtStockkeepingunitBySkuIdEanByEanData, DeleteApiCatalogPvtStockkeepingunitBySkuIdEanByEanResponses, DeleteApiCatalogPvtStockkeepingunitBySkuIdEanData, DeleteApiCatalogPvtStockkeepingunitBySkuIdEanResponses, DeleteApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdData, DeleteApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdResponses, DeleteApiCatalogPvtStockkeepingunitBySkuIdFileData, DeleteApiCatalogPvtStockkeepingunitBySkuIdFileResponses, DeleteApiCatalogPvtStockkeepingunitBySkuIdSpecificationBySpecificationIdData, DeleteApiCatalogPvtStockkeepingunitBySkuIdSpecificationBySpecificationIdResponses, DeleteApiCatalogPvtStockkeepingunitBySkuIdSpecificationData, DeleteApiCatalogPvtStockkeepingunitBySkuIdSpecificationResponses, DeleteApiCatalogPvtStockkeepingunitDisassociateBySkuIdFileBySkuFileIdData, DeleteApiCatalogPvtStockkeepingunitDisassociateBySkuIdFileBySkuFileIdResponses, DeleteApiCatalogPvtStockkeepingunitkitByKitIdData, DeleteApiCatalogPvtStockkeepingunitkitByKitIdResponses, DeleteApiCatalogPvtStockkeepingunitkitData, DeleteApiCatalogPvtStockkeepingunitkitResponses, DeleteApiCatalogPvtSubcollectionBySubCollectionIdBrandByBrandIdData, DeleteApiCatalogPvtSubcollectionBySubCollectionIdBrandByBrandIdResponses, DeleteApiCatalogPvtSubcollectionBySubCollectionIdCategoryByCategoryIdData, DeleteApiCatalogPvtSubcollectionBySubCollectionIdCategoryByCategoryIdResponses, DeleteApiCatalogPvtSubcollectionBySubCollectionIdData, DeleteApiCatalogPvtSubcollectionBySubCollectionIdResponses, DeleteApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalueData, DeleteApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalueResponses, DeleteApiCatalogPvtSubcollectionBySubCollectionIdStockkeepingunitBySkuIdData, DeleteApiCatalogPvtSubcollectionBySubCollectionIdStockkeepingunitBySkuIdResponses, DeleteApiCatalogPvtSupplierBySupplierIdData, DeleteApiCatalogPvtSupplierBySupplierIdResponses, DeleteaProductSpecificationData, DeleteaProductSpecificationErrors, DeleteaProductSpecificationResponses, DeleteSkuComplementbySkuComplementIdData, DeleteSkuComplementbySkuComplementIdResponses, DeleteSkUsellerassociationData, DeleteSkUsellerassociationResponses, GetAllCommercialConditionsData, GetAllCommercialConditionsResponses, GetAllInactiveCollectionsData, GetAllInactiveCollectionsResponses, GetApiAddonPvtReviewGetProductRateByProductIdData, GetApiAddonPvtReviewGetProductRateByProductIdResponses, GetApiCatalogPvtAttachmentByAttachmentidData, GetApiCatalogPvtAttachmentByAttachmentIdLanguageData, GetApiCatalogPvtAttachmentByAttachmentIdLanguageErrors, GetApiCatalogPvtAttachmentByAttachmentIdLanguageResponses, GetApiCatalogPvtAttachmentByAttachmentidResponses, GetApiCatalogPvtAttachmentsData, GetApiCatalogPvtAttachmentsResponses, GetApiCatalogPvtBrandByBrandIdData, GetApiCatalogPvtBrandByBrandIdLanguageData, GetApiCatalogPvtBrandByBrandIdLanguageErrors, GetApiCatalogPvtBrandByBrandIdLanguageResponses, GetApiCatalogPvtBrandByBrandIdResponses, GetApiCatalogPvtCategoryByCategoryIdData, GetApiCatalogPvtCategoryByCategoryIdLanguageData, GetApiCatalogPvtCategoryByCategoryIdLanguageErrors, GetApiCatalogPvtCategoryByCategoryIdLanguageResponses, GetApiCatalogPvtCategoryByCategoryIdResponses, GetApiCatalogPvtCollectionByCollectionIdData, GetApiCatalogPvtCollectionByCollectionIdLanguageData, GetApiCatalogPvtCollectionByCollectionIdLanguageErrors, GetApiCatalogPvtCollectionByCollectionIdLanguageResponses, GetApiCatalogPvtCollectionByCollectionIdResponses, GetApiCatalogPvtCollectionByCollectionIdSubcollectionData, GetApiCatalogPvtCollectionByCollectionIdSubcollectionResponses, GetApiCatalogPvtProductByProductIdLanguageData, GetApiCatalogPvtProductByProductIdLanguageErrors, GetApiCatalogPvtProductByProductIdLanguageResponses, GetApiCatalogPvtProductByProductIdSalespolicyData, GetApiCatalogPvtProductByProductIdSalespolicyResponses, GetApiCatalogPvtProductByProductIdSimilarcategoryData, GetApiCatalogPvtProductByProductIdSimilarcategoryResponses, GetApiCatalogPvtProductsByProductIdSpecificationBySpecificationIdLanguageData, GetApiCatalogPvtProductsByProductIdSpecificationBySpecificationIdLanguageErrors, GetApiCatalogPvtProductsByProductIdSpecificationBySpecificationIdLanguageResponses, GetApiCatalogPvtSkuserviceBySkuServiceIdData, GetApiCatalogPvtSkuserviceBySkuserviceIdLanguageData, GetApiCatalogPvtSkuserviceBySkuserviceIdLanguageErrors, GetApiCatalogPvtSkuserviceBySkuserviceIdLanguageResponses, GetApiCatalogPvtSkuserviceBySkuServiceIdResponses, GetApiCatalogPvtSkuservicetypeBySkuServiceTypeIdData, GetApiCatalogPvtSkuservicetypeBySkuServiceTypeIdLanguageData, GetApiCatalogPvtSkuservicetypeBySkuServiceTypeIdLanguageErrors, GetApiCatalogPvtSkuservicetypeBySkuServiceTypeIdLanguageResponses, GetApiCatalogPvtSkuservicetypeBySkuServiceTypeIdResponses, GetApiCatalogPvtSkuservicevalueBySkuServiceValueIdData, GetApiCatalogPvtSkuservicevalueBySkuServiceValueIdLanguageData, GetApiCatalogPvtSkuservicevalueBySkuServiceValueIdLanguageErrors, GetApiCatalogPvtSkuservicevalueBySkuServiceValueIdLanguageResponses, GetApiCatalogPvtSkuservicevalueBySkuServiceValueIdResponses, GetApiCatalogPvtSpecificationBySpecificationIdData, GetApiCatalogPvtSpecificationBySpecificationIdLanguageData, GetApiCatalogPvtSpecificationBySpecificationIdLanguageErrors, GetApiCatalogPvtSpecificationBySpecificationIdLanguageResponses, GetApiCatalogPvtSpecificationBySpecificationIdResponses, GetApiCatalogPvtSpecificationgroupBySpecificationGroupIdLanguageData, GetApiCatalogPvtSpecificationgroupBySpecificationGroupIdLanguageErrors, GetApiCatalogPvtSpecificationgroupBySpecificationGroupIdLanguageResponses, GetApiCatalogPvtSpecificationNonstructuredByIdData, GetApiCatalogPvtSpecificationNonstructuredByIdResponses, GetApiCatalogPvtSpecificationNonstructuredData, GetApiCatalogPvtSpecificationNonstructuredResponses, GetApiCatalogPvtSpecificationvalueBySpecificationValueIdData, GetApiCatalogPvtSpecificationvalueBySpecificationValueIdResponses, GetApiCatalogPvtSpecificationvalueByValueIdLanguageData, GetApiCatalogPvtSpecificationvalueByValueIdLanguageErrors, GetApiCatalogPvtSpecificationvalueByValueIdLanguageResponses, GetApiCatalogPvtStockkeepingunitBySkuIdAttachmentData, GetApiCatalogPvtStockkeepingunitBySkuIdAttachmentResponses, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdData, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdLanguageData, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdLanguageErrors, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdLanguageResponses, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdResponses, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeData, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeResponses, GetApiCatalogPvtStockkeepingunitBySkuIdEanData, GetApiCatalogPvtStockkeepingunitBySkuIdEanResponses, GetApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdLanguageData, GetApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdLanguageErrors, GetApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdLanguageResponses, GetApiCatalogPvtStockkeepingunitBySkuIdFileData, GetApiCatalogPvtStockkeepingunitBySkuIdFileResponses, GetApiCatalogPvtStockkeepingunitBySkuIdLanguageData, GetApiCatalogPvtStockkeepingunitBySkuIdLanguageErrors, GetApiCatalogPvtStockkeepingunitBySkuIdLanguageResponses, GetApiCatalogPvtStockkeepingunitBySkuIdSpecificationData, GetApiCatalogPvtStockkeepingunitBySkuIdSpecificationResponses, GetApiCatalogPvtStockkeepingunitData, GetApiCatalogPvtStockkeepingunitkitByKitIdData, GetApiCatalogPvtStockkeepingunitkitByKitIdResponses, GetApiCatalogPvtStockkeepingunitkitData, GetApiCatalogPvtStockkeepingunitkitResponses, GetApiCatalogPvtStockkeepingunitResponses, GetApiCatalogPvtSubcollectionBySubCollectionIdData, GetApiCatalogPvtSubcollectionBySubCollectionIdResponses, GetApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalueData, GetApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalueResponses, GetApiCatalogSystemPvtSkuStockkeepingunitidsbysaleschannelData, GetApiCatalogSystemPvtSkuStockkeepingunitidsbysaleschannelResponses, GetCommercialConditionsData, GetCommercialConditionsResponses, GetGiftListData, GetGiftListResponses, GetImportfileexampleData, GetImportfileexampleResponses, GetProductbyidData, GetProductbyidResponses, GetProductsfromacollectionData, GetProductsfromacollectionResponses, GetProductSpecificationbyProductIdData, GetProductSpecificationbyProductIdResponses, GetProductSpecificationData, GetProductSpecificationResponses, GetSellerbyIdData, GetSellerbyIdResponses, GetSellersbyIdData, GetSellersbyIdResponses, GetSkuComplementbySkuComplementIdData, GetSkuComplementbySkuComplementIdResponses, GetSkuComplementbySkuidData, GetSkuComplementbySkuidResponses, GetSkuComplementsbyComplementTypeIdData, GetSkuComplementsbyComplementTypeIdResponses, GetSkUcomplementsbytypeData, GetSkUcomplementsbytypeResponses, GetSkUsellerData, GetSkUsellerResponses, IndexedInfoData, IndexedInfoResponses, ListallSkuidsData, ListallSkuidsResponses, PostAddproductsbyimportfileData, PostAddproductsbyimportfileResponses, PostApiCatalogPvtAttachmentData, PostApiCatalogPvtAttachmentResponses, PostApiCatalogPvtBrandData, PostApiCatalogPvtBrandResponses, PostApiCatalogPvtCategoryData, PostApiCatalogPvtCategoryResponses, PostApiCatalogPvtCollectionByCollectionIdPositionData, PostApiCatalogPvtCollectionByCollectionIdPositionResponses, PostApiCatalogPvtProductByProductIdSalespolicyByTradepolicyIdData, PostApiCatalogPvtProductByProductIdSalespolicyByTradepolicyIdResponses, PostApiCatalogPvtProductByProductIdSimilarcategoryByCategoryIdData, PostApiCatalogPvtProductByProductIdSimilarcategoryByCategoryIdResponses, PostApiCatalogPvtProductByProductIdSpecificationData, PostApiCatalogPvtProductByProductIdSpecificationResponses, PostApiCatalogPvtProductData, PostApiCatalogPvtProductResponses, PostApiCatalogPvtSkuattachmentData, PostApiCatalogPvtSkuattachmentResponses, PostApiCatalogPvtSkuserviceData, PostApiCatalogPvtSkuserviceResponses, PostApiCatalogPvtSkuservicetypeattachmentData, PostApiCatalogPvtSkuservicetypeattachmentResponses, PostApiCatalogPvtSkuservicetypeData, PostApiCatalogPvtSkuservicetypeResponses, PostApiCatalogPvtSkuservicevalueData, PostApiCatalogPvtSkuservicevalueResponses, PostApiCatalogPvtSpecificationData, PostApiCatalogPvtSpecificationResponses, PostApiCatalogPvtSpecificationvalueData, PostApiCatalogPvtSpecificationvalueResponses, PostApiCatalogPvtStockkeepingunitBySkuIdAttributeData, PostApiCatalogPvtStockkeepingunitBySkuIdAttributeErrors, PostApiCatalogPvtStockkeepingunitBySkuIdAttributeResponses, PostApiCatalogPvtStockkeepingunitBySkuIdEanByEanData, PostApiCatalogPvtStockkeepingunitBySkuIdEanByEanResponses, PostApiCatalogPvtStockkeepingunitBySkuIdFileData, PostApiCatalogPvtStockkeepingunitBySkuIdFileResponses, PostApiCatalogPvtStockkeepingunitBySkuIdSpecificationData, PostApiCatalogPvtStockkeepingunitBySkuIdSpecificationResponses, PostApiCatalogPvtStockkeepingunitData, PostApiCatalogPvtStockkeepingunitkitData, PostApiCatalogPvtStockkeepingunitkitResponses, PostApiCatalogPvtStockkeepingunitResponses, PostApiCatalogPvtSubcollectionBySubCollectionIdBrandData, PostApiCatalogPvtSubcollectionBySubCollectionIdBrandResponses, PostApiCatalogPvtSubcollectionBySubCollectionIdCategoryData, PostApiCatalogPvtSubcollectionBySubCollectionIdCategoryResponses, PostApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalueData, PostApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalueResponses, PostApiCatalogPvtSubcollectionBySubCollectionIdStockkeepingunitData, PostApiCatalogPvtSubcollectionBySubCollectionIdStockkeepingunitResponses, PostApiCatalogPvtSubcollectionData, PostApiCatalogPvtSubcollectionResponses, PostApiCatalogPvtSupplierData, PostApiCatalogPvtSupplierResponses, PostApiCatalogSystemPvtSkusellerChangenotificationBySellerIdBySellerSkuIdData, PostApiCatalogSystemPvtSkusellerChangenotificationBySellerIdBySellerSkuIdResponses, PostCreateCollectionData, PostCreateCollectionResponses, PostRemoveproductsbyimportfileData, PostRemoveproductsbyimportfileResponses, ProductAndSkuIdsData, ProductAndSkuIdsResponses, ProductandTradePolicyData, ProductandTradePolicyResponses, ProductbyRefIdData, ProductbyRefIdResponses, ProductVariationsData, ProductVariationsResponses, PutApiCatalogPvtAttachmentByAttachmentidData, PutApiCatalogPvtAttachmentByAttachmentIdLanguageData, PutApiCatalogPvtAttachmentByAttachmentIdLanguageErrors, PutApiCatalogPvtAttachmentByAttachmentIdLanguageResponses, PutApiCatalogPvtAttachmentByAttachmentidResponses, PutApiCatalogPvtBrandByBrandIdData, PutApiCatalogPvtBrandByBrandIdLanguageData, PutApiCatalogPvtBrandByBrandIdLanguageErrors, PutApiCatalogPvtBrandByBrandIdLanguageResponses, PutApiCatalogPvtBrandByBrandIdResponses, PutApiCatalogPvtCategoryByCategoryIdData, PutApiCatalogPvtCategoryByCategoryIdLanguageData, PutApiCatalogPvtCategoryByCategoryIdLanguageErrors, PutApiCatalogPvtCategoryByCategoryIdLanguageResponses, PutApiCatalogPvtCategoryByCategoryIdResponses, PutApiCatalogPvtCollectionByCollectionIdData, PutApiCatalogPvtCollectionByCollectionIdLanguageData, PutApiCatalogPvtCollectionByCollectionIdLanguageErrors, PutApiCatalogPvtCollectionByCollectionIdLanguageResponses, PutApiCatalogPvtCollectionByCollectionIdResponses, PutApiCatalogPvtProductByProductIdData, PutApiCatalogPvtProductByProductIdLanguageData, PutApiCatalogPvtProductByProductIdLanguageErrors, PutApiCatalogPvtProductByProductIdLanguageResponses, PutApiCatalogPvtProductByProductIdResponses, PutApiCatalogPvtProductByProductIdSpecificationvalueData, PutApiCatalogPvtProductByProductIdSpecificationvalueResponses, PutApiCatalogPvtProductsByProductIdSpecificationBySpecificationIdLanguageData, PutApiCatalogPvtProductsByProductIdSpecificationBySpecificationIdLanguageErrors, PutApiCatalogPvtProductsByProductIdSpecificationBySpecificationIdLanguageResponses, PutApiCatalogPvtSkuserviceBySkuServiceIdData, PutApiCatalogPvtSkuserviceBySkuserviceIdLanguageData, PutApiCatalogPvtSkuserviceBySkuserviceIdLanguageErrors, PutApiCatalogPvtSkuserviceBySkuserviceIdLanguageResponses, PutApiCatalogPvtSkuserviceBySkuServiceIdResponses, PutApiCatalogPvtSkuservicetypeBySkuServiceTypeIdData, PutApiCatalogPvtSkuservicetypeBySkuServiceTypeIdLanguageData, PutApiCatalogPvtSkuservicetypeBySkuServiceTypeIdLanguageErrors, PutApiCatalogPvtSkuservicetypeBySkuServiceTypeIdLanguageResponses, PutApiCatalogPvtSkuservicetypeBySkuServiceTypeIdResponses, PutApiCatalogPvtSkuservicevalueBySkuServiceValueIdData, PutApiCatalogPvtSkuservicevalueBySkuServiceValueIdLanguageData, PutApiCatalogPvtSkuservicevalueBySkuServiceValueIdLanguageErrors, PutApiCatalogPvtSkuservicevalueBySkuServiceValueIdLanguageResponses, PutApiCatalogPvtSkuservicevalueBySkuServiceValueIdResponses, PutApiCatalogPvtSpecificationBySpecificationIdData, PutApiCatalogPvtSpecificationBySpecificationIdLanguageData, PutApiCatalogPvtSpecificationBySpecificationIdLanguageErrors, PutApiCatalogPvtSpecificationBySpecificationIdLanguageResponses, PutApiCatalogPvtSpecificationBySpecificationIdResponses, PutApiCatalogPvtSpecificationgroupByGroupIdData, PutApiCatalogPvtSpecificationgroupByGroupIdResponses, PutApiCatalogPvtSpecificationgroupBySpecificationGroupIdLanguageData, PutApiCatalogPvtSpecificationgroupBySpecificationGroupIdLanguageErrors, PutApiCatalogPvtSpecificationgroupBySpecificationGroupIdLanguageResponses, PutApiCatalogPvtSpecificationvalueBySpecificationValueIdData, PutApiCatalogPvtSpecificationvalueBySpecificationValueIdResponses, PutApiCatalogPvtSpecificationvalueByValueIdLanguageData, PutApiCatalogPvtSpecificationvalueByValueIdLanguageErrors, PutApiCatalogPvtSpecificationvalueByValueIdLanguageResponses, PutApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdData, PutApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdErrors, PutApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdLanguageData, PutApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdLanguageErrors, PutApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdLanguageResponses, PutApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdResponses, PutApiCatalogPvtStockkeepingunitBySkuIdData, PutApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdData, PutApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdLanguageData, PutApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdLanguageErrors, PutApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdLanguageResponses, PutApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdResponses, PutApiCatalogPvtStockkeepingunitBySkuIdFileReorderData, PutApiCatalogPvtStockkeepingunitBySkuIdFileReorderErrors, PutApiCatalogPvtStockkeepingunitBySkuIdFileReorderResponses, PutApiCatalogPvtStockkeepingunitBySkuIdLanguageData, PutApiCatalogPvtStockkeepingunitBySkuIdLanguageErrors, PutApiCatalogPvtStockkeepingunitBySkuIdLanguageResponses, PutApiCatalogPvtStockkeepingunitBySkuIdResponses, PutApiCatalogPvtStockkeepingunitBySkuIdSpecificationData, PutApiCatalogPvtStockkeepingunitBySkuIdSpecificationResponses, PutApiCatalogPvtStockkeepingunitBySkuIdSpecificationvalueData, PutApiCatalogPvtStockkeepingunitBySkuIdSpecificationvalueResponses, PutApiCatalogPvtStockkeepingunitCopyBySkuIdfromBySkuIdtoFileData, PutApiCatalogPvtStockkeepingunitCopyBySkuIdfromBySkuIdtoFileResponses, PutApiCatalogPvtSubcollectionBySubCollectionIdData, PutApiCatalogPvtSubcollectionBySubCollectionIdResponses, PutApiCatalogPvtSupplierBySupplierIdData, PutApiCatalogPvtSupplierBySupplierIdResponses, SalesChannelbyIdData, SalesChannelbyIdResponses, SalesChannelListData, SalesChannelListResponses, SellerListData, SellerListResponses, SkubyAlternateIdData, SkubyAlternateIdResponses, SkubyEanData, SkubyEanResponses, SkuContextData, SkuContextResponses, SkuData, SkuIdbyRefIdData, SkuIdbyRefIdResponses, SkuIdlistbyRefIdlistData, SkuIdlistbyRefIdlistErrors, SkuIdlistbyRefIdlistResponses, SkulistbyProductIdData, SkulistbyProductIdResponses, SkuResponses, SpecificationGroupInsert2Data, SpecificationGroupInsert2Responses, SpecificationsByCategoryIdData, SpecificationsByCategoryIdResponses, SpecificationsFieldData, SpecificationsFieldResponses, SpecificationsGetFieldValueData, SpecificationsGetFieldValueResponses, SpecificationsGroupGetData, SpecificationsGroupGetResponses, SpecificationsGroupListbyCategoryData, SpecificationsGroupListbyCategoryResponses, SpecificationsInsertFieldData, SpecificationsInsertFieldResponses, SpecificationsInsertFieldUpdateData, SpecificationsInsertFieldUpdateResponses, SpecificationsInsertFieldValueData, SpecificationsInsertFieldValueResponses, SpecificationsTreeByCategoryIdData, SpecificationsTreeByCategoryIdResponses, SpecificationsUpdateFieldValueData, SpecificationsUpdateFieldValueResponses, SpecificationsValuesByFieldIdData, SpecificationsValuesByFieldIdResponses, UpdateProductSpecificationData, UpdateProductSpecificationResponses, UpdateSellerData, UpdateSellerResponses } from './types.gen'; +import type { AssociateattachmentstoSkuData, AssociateattachmentstoSkuResponses, BrandData, BrandListData, BrandListPerPageData, BrandListPerPageResponses, BrandListResponses, BrandResponses, CategoryTreeData, CategoryTreeResponses, ChangeNotificationData, ChangeNotificationErrors, ChangeNotificationResponses, CreateSellerData, CreateSellerResponses, CreateSkuComplementData, CreateSkuComplementResponses, DeleteAllProductSpecificationsData, DeleteAllProductSpecificationsResponses, DeleteApiCatalogPvtAssortmentByProductAssortmentIdData, DeleteApiCatalogPvtAssortmentByProductAssortmentIdErrors, DeleteApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdData, DeleteApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdErrors, DeleteApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdResponses, DeleteApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdData, DeleteApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdErrors, DeleteApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdResponses, DeleteApiCatalogPvtAssortmentByProductAssortmentIdResponses, DeleteApiCatalogPvtAttachmentByAttachmentidData, DeleteApiCatalogPvtAttachmentByAttachmentidResponses, DeleteApiCatalogPvtBrandByBrandIdData, DeleteApiCatalogPvtBrandByBrandIdResponses, DeleteApiCatalogPvtCollectionByCollectionIdData, DeleteApiCatalogPvtCollectionByCollectionIdResponses, DeleteApiCatalogPvtProductByProductIdSalespolicyByTradepolicyIdData, DeleteApiCatalogPvtProductByProductIdSalespolicyByTradepolicyIdResponses, DeleteApiCatalogPvtProductByProductIdSimilarcategoryByCategoryIdData, DeleteApiCatalogPvtProductByProductIdSimilarcategoryByCategoryIdResponses, DeleteApiCatalogPvtSkuattachmentBySkuAttachmentAssociationIdData, DeleteApiCatalogPvtSkuattachmentBySkuAttachmentAssociationIdResponses, DeleteApiCatalogPvtSkuattachmentData, DeleteApiCatalogPvtSkuattachmentResponses, DeleteApiCatalogPvtSkuserviceBySkuServiceIdData, DeleteApiCatalogPvtSkuserviceBySkuServiceIdResponses, DeleteApiCatalogPvtSkuservicetypeattachmentBySkuServiceTypeAttachmentIdData, DeleteApiCatalogPvtSkuservicetypeattachmentBySkuServiceTypeAttachmentIdResponses, DeleteApiCatalogPvtSkuservicetypeattachmentData, DeleteApiCatalogPvtSkuservicetypeattachmentResponses, DeleteApiCatalogPvtSkuservicetypeBySkuServiceTypeIdData, DeleteApiCatalogPvtSkuservicetypeBySkuServiceTypeIdResponses, DeleteApiCatalogPvtSkuservicevalueBySkuServiceValueIdData, DeleteApiCatalogPvtSkuservicevalueBySkuServiceValueIdResponses, DeleteApiCatalogPvtSpecificationNonstructuredByIdData, DeleteApiCatalogPvtSpecificationNonstructuredByIdResponses, DeleteApiCatalogPvtSpecificationNonstructuredData, DeleteApiCatalogPvtSpecificationNonstructuredResponses, DeleteApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdData, DeleteApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdResponses, DeleteApiCatalogPvtStockkeepingunitBySkuIdAttributeData, DeleteApiCatalogPvtStockkeepingunitBySkuIdAttributeResponses, DeleteApiCatalogPvtStockkeepingunitBySkuIdEanByEanData, DeleteApiCatalogPvtStockkeepingunitBySkuIdEanByEanResponses, DeleteApiCatalogPvtStockkeepingunitBySkuIdEanData, DeleteApiCatalogPvtStockkeepingunitBySkuIdEanResponses, DeleteApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdData, DeleteApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdResponses, DeleteApiCatalogPvtStockkeepingunitBySkuIdFileData, DeleteApiCatalogPvtStockkeepingunitBySkuIdFileResponses, DeleteApiCatalogPvtStockkeepingunitBySkuIdSpecificationBySpecificationIdData, DeleteApiCatalogPvtStockkeepingunitBySkuIdSpecificationBySpecificationIdResponses, DeleteApiCatalogPvtStockkeepingunitBySkuIdSpecificationData, DeleteApiCatalogPvtStockkeepingunitBySkuIdSpecificationResponses, DeleteApiCatalogPvtStockkeepingunitDisassociateBySkuIdFileBySkuFileIdData, DeleteApiCatalogPvtStockkeepingunitDisassociateBySkuIdFileBySkuFileIdResponses, DeleteApiCatalogPvtStockkeepingunitkitByKitIdData, DeleteApiCatalogPvtStockkeepingunitkitByKitIdResponses, DeleteApiCatalogPvtStockkeepingunitkitData, DeleteApiCatalogPvtStockkeepingunitkitResponses, DeleteApiCatalogPvtSubcollectionBySubCollectionIdBrandByBrandIdData, DeleteApiCatalogPvtSubcollectionBySubCollectionIdBrandByBrandIdResponses, DeleteApiCatalogPvtSubcollectionBySubCollectionIdCategoryByCategoryIdData, DeleteApiCatalogPvtSubcollectionBySubCollectionIdCategoryByCategoryIdResponses, DeleteApiCatalogPvtSubcollectionBySubCollectionIdData, DeleteApiCatalogPvtSubcollectionBySubCollectionIdResponses, DeleteApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalueData, DeleteApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalueResponses, DeleteApiCatalogPvtSubcollectionBySubCollectionIdStockkeepingunitBySkuIdData, DeleteApiCatalogPvtSubcollectionBySubCollectionIdStockkeepingunitBySkuIdResponses, DeleteApiCatalogPvtSupplierBySupplierIdData, DeleteApiCatalogPvtSupplierBySupplierIdResponses, DeleteaProductSpecificationData, DeleteaProductSpecificationErrors, DeleteaProductSpecificationResponses, DeleteSkuComplementbySkuComplementIdData, DeleteSkuComplementbySkuComplementIdResponses, DeleteSkUsellerassociationData, DeleteSkUsellerassociationResponses, GetAllCommercialConditionsData, GetAllCommercialConditionsResponses, GetAllInactiveCollectionsData, GetAllInactiveCollectionsResponses, GetApiAddonPvtReviewGetProductRateByProductIdData, GetApiAddonPvtReviewGetProductRateByProductIdResponses, GetApiCatalogPvtAssortmentByProductAssortmentIdData, GetApiCatalogPvtAssortmentByProductAssortmentIdErrors, GetApiCatalogPvtAssortmentByProductAssortmentIdResponses, GetApiCatalogPvtAssortmentData, GetApiCatalogPvtAssortmentResponses, GetApiCatalogPvtAttachmentByAttachmentidData, GetApiCatalogPvtAttachmentByAttachmentIdLanguageData, GetApiCatalogPvtAttachmentByAttachmentIdLanguageErrors, GetApiCatalogPvtAttachmentByAttachmentIdLanguageResponses, GetApiCatalogPvtAttachmentByAttachmentidResponses, GetApiCatalogPvtAttachmentsData, GetApiCatalogPvtAttachmentsResponses, GetApiCatalogPvtBrandByBrandIdData, GetApiCatalogPvtBrandByBrandIdLanguageData, GetApiCatalogPvtBrandByBrandIdLanguageErrors, GetApiCatalogPvtBrandByBrandIdLanguageResponses, GetApiCatalogPvtBrandByBrandIdResponses, GetApiCatalogPvtCategoryByCategoryIdData, GetApiCatalogPvtCategoryByCategoryIdLanguageData, GetApiCatalogPvtCategoryByCategoryIdLanguageErrors, GetApiCatalogPvtCategoryByCategoryIdLanguageResponses, GetApiCatalogPvtCategoryByCategoryIdResponses, GetApiCatalogPvtCollectionByCollectionIdData, GetApiCatalogPvtCollectionByCollectionIdLanguageData, GetApiCatalogPvtCollectionByCollectionIdLanguageErrors, GetApiCatalogPvtCollectionByCollectionIdLanguageResponses, GetApiCatalogPvtCollectionByCollectionIdResponses, GetApiCatalogPvtCollectionByCollectionIdSubcollectionData, GetApiCatalogPvtCollectionByCollectionIdSubcollectionResponses, GetApiCatalogPvtProductByProductIdLanguageData, GetApiCatalogPvtProductByProductIdLanguageErrors, GetApiCatalogPvtProductByProductIdLanguageResponses, GetApiCatalogPvtProductByProductIdSalespolicyData, GetApiCatalogPvtProductByProductIdSalespolicyResponses, GetApiCatalogPvtProductByProductIdSimilarcategoryData, GetApiCatalogPvtProductByProductIdSimilarcategoryResponses, GetApiCatalogPvtProductsByProductIdSpecificationBySpecificationIdLanguageData, GetApiCatalogPvtProductsByProductIdSpecificationBySpecificationIdLanguageErrors, GetApiCatalogPvtProductsByProductIdSpecificationBySpecificationIdLanguageResponses, GetApiCatalogPvtSkuserviceBySkuServiceIdData, GetApiCatalogPvtSkuserviceBySkuserviceIdLanguageData, GetApiCatalogPvtSkuserviceBySkuserviceIdLanguageErrors, GetApiCatalogPvtSkuserviceBySkuserviceIdLanguageResponses, GetApiCatalogPvtSkuserviceBySkuServiceIdResponses, GetApiCatalogPvtSkuservicetypeBySkuServiceTypeIdData, GetApiCatalogPvtSkuservicetypeBySkuServiceTypeIdLanguageData, GetApiCatalogPvtSkuservicetypeBySkuServiceTypeIdLanguageErrors, GetApiCatalogPvtSkuservicetypeBySkuServiceTypeIdLanguageResponses, GetApiCatalogPvtSkuservicetypeBySkuServiceTypeIdResponses, GetApiCatalogPvtSkuservicevalueBySkuServiceValueIdData, GetApiCatalogPvtSkuservicevalueBySkuServiceValueIdLanguageData, GetApiCatalogPvtSkuservicevalueBySkuServiceValueIdLanguageErrors, GetApiCatalogPvtSkuservicevalueBySkuServiceValueIdLanguageResponses, GetApiCatalogPvtSkuservicevalueBySkuServiceValueIdResponses, GetApiCatalogPvtSpecificationBySpecificationIdData, GetApiCatalogPvtSpecificationBySpecificationIdLanguageData, GetApiCatalogPvtSpecificationBySpecificationIdLanguageErrors, GetApiCatalogPvtSpecificationBySpecificationIdLanguageResponses, GetApiCatalogPvtSpecificationBySpecificationIdResponses, GetApiCatalogPvtSpecificationgroupBySpecificationGroupIdLanguageData, GetApiCatalogPvtSpecificationgroupBySpecificationGroupIdLanguageErrors, GetApiCatalogPvtSpecificationgroupBySpecificationGroupIdLanguageResponses, GetApiCatalogPvtSpecificationNonstructuredByIdData, GetApiCatalogPvtSpecificationNonstructuredByIdResponses, GetApiCatalogPvtSpecificationNonstructuredData, GetApiCatalogPvtSpecificationNonstructuredResponses, GetApiCatalogPvtSpecificationvalueBySpecificationValueIdData, GetApiCatalogPvtSpecificationvalueBySpecificationValueIdResponses, GetApiCatalogPvtSpecificationvalueByValueIdLanguageData, GetApiCatalogPvtSpecificationvalueByValueIdLanguageErrors, GetApiCatalogPvtSpecificationvalueByValueIdLanguageResponses, GetApiCatalogPvtStockkeepingunitBySkuIdAttachmentData, GetApiCatalogPvtStockkeepingunitBySkuIdAttachmentResponses, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdData, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdLanguageData, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdLanguageErrors, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdLanguageResponses, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdResponses, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeData, GetApiCatalogPvtStockkeepingunitBySkuIdAttributeResponses, GetApiCatalogPvtStockkeepingunitBySkuIdEanData, GetApiCatalogPvtStockkeepingunitBySkuIdEanResponses, GetApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdLanguageData, GetApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdLanguageErrors, GetApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdLanguageResponses, GetApiCatalogPvtStockkeepingunitBySkuIdFileData, GetApiCatalogPvtStockkeepingunitBySkuIdFileResponses, GetApiCatalogPvtStockkeepingunitBySkuIdLanguageData, GetApiCatalogPvtStockkeepingunitBySkuIdLanguageErrors, GetApiCatalogPvtStockkeepingunitBySkuIdLanguageResponses, GetApiCatalogPvtStockkeepingunitBySkuIdSpecificationData, GetApiCatalogPvtStockkeepingunitBySkuIdSpecificationResponses, GetApiCatalogPvtStockkeepingunitData, GetApiCatalogPvtStockkeepingunitkitByKitIdData, GetApiCatalogPvtStockkeepingunitkitByKitIdResponses, GetApiCatalogPvtStockkeepingunitkitData, GetApiCatalogPvtStockkeepingunitkitResponses, GetApiCatalogPvtStockkeepingunitResponses, GetApiCatalogPvtSubcollectionBySubCollectionIdData, GetApiCatalogPvtSubcollectionBySubCollectionIdResponses, GetApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalueData, GetApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalueResponses, GetApiCatalogSystemPvtSkuStockkeepingunitidsbysaleschannelData, GetApiCatalogSystemPvtSkuStockkeepingunitidsbysaleschannelResponses, GetCommercialConditionsData, GetCommercialConditionsResponses, GetGiftListData, GetGiftListResponses, GetImportfileexampleData, GetImportfileexampleResponses, GetProductbyidData, GetProductbyidResponses, GetProductsfromacollectionData, GetProductsfromacollectionResponses, GetProductSpecificationbyProductIdData, GetProductSpecificationbyProductIdResponses, GetProductSpecificationData, GetProductSpecificationResponses, GetSellerbyIdData, GetSellerbyIdResponses, GetSellersbyIdData, GetSellersbyIdResponses, GetSkuComplementbySkuComplementIdData, GetSkuComplementbySkuComplementIdResponses, GetSkuComplementbySkuidData, GetSkuComplementbySkuidResponses, GetSkuComplementsbyComplementTypeIdData, GetSkuComplementsbyComplementTypeIdResponses, GetSkUcomplementsbytypeData, GetSkUcomplementsbytypeResponses, GetSkUsellerData, GetSkUsellerResponses, IndexedInfoData, IndexedInfoResponses, ListallSkuidsData, ListallSkuidsResponses, PostAddproductsbyimportfileData, PostAddproductsbyimportfileResponses, PostApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdData, PostApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdErrors, PostApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdResponses, PostApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdData, PostApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdErrors, PostApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdResponses, PostApiCatalogPvtAssortmentData, PostApiCatalogPvtAssortmentErrors, PostApiCatalogPvtAssortmentResponses, PostApiCatalogPvtAttachmentData, PostApiCatalogPvtAttachmentResponses, PostApiCatalogPvtBrandData, PostApiCatalogPvtBrandResponses, PostApiCatalogPvtCategoryData, PostApiCatalogPvtCategoryResponses, PostApiCatalogPvtCollectionByCollectionIdPositionData, PostApiCatalogPvtCollectionByCollectionIdPositionResponses, PostApiCatalogPvtProductByProductIdSalespolicyByTradepolicyIdData, PostApiCatalogPvtProductByProductIdSalespolicyByTradepolicyIdResponses, PostApiCatalogPvtProductByProductIdSimilarcategoryByCategoryIdData, PostApiCatalogPvtProductByProductIdSimilarcategoryByCategoryIdResponses, PostApiCatalogPvtProductByProductIdSpecificationData, PostApiCatalogPvtProductByProductIdSpecificationResponses, PostApiCatalogPvtProductData, PostApiCatalogPvtProductResponses, PostApiCatalogPvtSkuattachmentData, PostApiCatalogPvtSkuattachmentResponses, PostApiCatalogPvtSkuserviceData, PostApiCatalogPvtSkuserviceResponses, PostApiCatalogPvtSkuservicetypeattachmentData, PostApiCatalogPvtSkuservicetypeattachmentResponses, PostApiCatalogPvtSkuservicetypeData, PostApiCatalogPvtSkuservicetypeResponses, PostApiCatalogPvtSkuservicevalueData, PostApiCatalogPvtSkuservicevalueResponses, PostApiCatalogPvtSpecificationData, PostApiCatalogPvtSpecificationResponses, PostApiCatalogPvtSpecificationvalueData, PostApiCatalogPvtSpecificationvalueResponses, PostApiCatalogPvtStockkeepingunitBySkuIdAttributeData, PostApiCatalogPvtStockkeepingunitBySkuIdAttributeErrors, PostApiCatalogPvtStockkeepingunitBySkuIdAttributeResponses, PostApiCatalogPvtStockkeepingunitBySkuIdEanByEanData, PostApiCatalogPvtStockkeepingunitBySkuIdEanByEanResponses, PostApiCatalogPvtStockkeepingunitBySkuIdFileData, PostApiCatalogPvtStockkeepingunitBySkuIdFileResponses, PostApiCatalogPvtStockkeepingunitBySkuIdSpecificationData, PostApiCatalogPvtStockkeepingunitBySkuIdSpecificationResponses, PostApiCatalogPvtStockkeepingunitData, PostApiCatalogPvtStockkeepingunitkitData, PostApiCatalogPvtStockkeepingunitkitResponses, PostApiCatalogPvtStockkeepingunitResponses, PostApiCatalogPvtSubcollectionBySubCollectionIdBrandData, PostApiCatalogPvtSubcollectionBySubCollectionIdBrandResponses, PostApiCatalogPvtSubcollectionBySubCollectionIdCategoryData, PostApiCatalogPvtSubcollectionBySubCollectionIdCategoryResponses, PostApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalueData, PostApiCatalogPvtSubcollectionBySubCollectionIdSpecificationvalueResponses, PostApiCatalogPvtSubcollectionBySubCollectionIdStockkeepingunitData, PostApiCatalogPvtSubcollectionBySubCollectionIdStockkeepingunitResponses, PostApiCatalogPvtSubcollectionData, PostApiCatalogPvtSubcollectionResponses, PostApiCatalogPvtSupplierData, PostApiCatalogPvtSupplierResponses, PostApiCatalogSystemPvtSkusellerChangenotificationBySellerIdBySellerSkuIdData, PostApiCatalogSystemPvtSkusellerChangenotificationBySellerIdBySellerSkuIdResponses, PostCreateCollectionData, PostCreateCollectionResponses, PostRemoveproductsbyimportfileData, PostRemoveproductsbyimportfileResponses, ProductAndSkuIdsData, ProductAndSkuIdsResponses, ProductandTradePolicyData, ProductandTradePolicyResponses, ProductbyRefIdData, ProductbyRefIdResponses, ProductVariationsData, ProductVariationsResponses, PutApiCatalogPvtAssortmentByProductAssortmentIdData, PutApiCatalogPvtAssortmentByProductAssortmentIdErrors, PutApiCatalogPvtAssortmentByProductAssortmentIdResponses, PutApiCatalogPvtAttachmentByAttachmentidData, PutApiCatalogPvtAttachmentByAttachmentIdLanguageData, PutApiCatalogPvtAttachmentByAttachmentIdLanguageErrors, PutApiCatalogPvtAttachmentByAttachmentIdLanguageResponses, PutApiCatalogPvtAttachmentByAttachmentidResponses, PutApiCatalogPvtBrandByBrandIdData, PutApiCatalogPvtBrandByBrandIdLanguageData, PutApiCatalogPvtBrandByBrandIdLanguageErrors, PutApiCatalogPvtBrandByBrandIdLanguageResponses, PutApiCatalogPvtBrandByBrandIdResponses, PutApiCatalogPvtCategoryByCategoryIdData, PutApiCatalogPvtCategoryByCategoryIdLanguageData, PutApiCatalogPvtCategoryByCategoryIdLanguageErrors, PutApiCatalogPvtCategoryByCategoryIdLanguageResponses, PutApiCatalogPvtCategoryByCategoryIdResponses, PutApiCatalogPvtCollectionByCollectionIdData, PutApiCatalogPvtCollectionByCollectionIdLanguageData, PutApiCatalogPvtCollectionByCollectionIdLanguageErrors, PutApiCatalogPvtCollectionByCollectionIdLanguageResponses, PutApiCatalogPvtCollectionByCollectionIdResponses, PutApiCatalogPvtProductByProductIdData, PutApiCatalogPvtProductByProductIdLanguageData, PutApiCatalogPvtProductByProductIdLanguageErrors, PutApiCatalogPvtProductByProductIdLanguageResponses, PutApiCatalogPvtProductByProductIdResponses, PutApiCatalogPvtProductByProductIdSpecificationvalueData, PutApiCatalogPvtProductByProductIdSpecificationvalueResponses, PutApiCatalogPvtProductsByProductIdSpecificationBySpecificationIdLanguageData, PutApiCatalogPvtProductsByProductIdSpecificationBySpecificationIdLanguageErrors, PutApiCatalogPvtProductsByProductIdSpecificationBySpecificationIdLanguageResponses, PutApiCatalogPvtSkuserviceBySkuServiceIdData, PutApiCatalogPvtSkuserviceBySkuserviceIdLanguageData, PutApiCatalogPvtSkuserviceBySkuserviceIdLanguageErrors, PutApiCatalogPvtSkuserviceBySkuserviceIdLanguageResponses, PutApiCatalogPvtSkuserviceBySkuServiceIdResponses, PutApiCatalogPvtSkuservicetypeBySkuServiceTypeIdData, PutApiCatalogPvtSkuservicetypeBySkuServiceTypeIdLanguageData, PutApiCatalogPvtSkuservicetypeBySkuServiceTypeIdLanguageErrors, PutApiCatalogPvtSkuservicetypeBySkuServiceTypeIdLanguageResponses, PutApiCatalogPvtSkuservicetypeBySkuServiceTypeIdResponses, PutApiCatalogPvtSkuservicevalueBySkuServiceValueIdData, PutApiCatalogPvtSkuservicevalueBySkuServiceValueIdLanguageData, PutApiCatalogPvtSkuservicevalueBySkuServiceValueIdLanguageErrors, PutApiCatalogPvtSkuservicevalueBySkuServiceValueIdLanguageResponses, PutApiCatalogPvtSkuservicevalueBySkuServiceValueIdResponses, PutApiCatalogPvtSpecificationBySpecificationIdData, PutApiCatalogPvtSpecificationBySpecificationIdLanguageData, PutApiCatalogPvtSpecificationBySpecificationIdLanguageErrors, PutApiCatalogPvtSpecificationBySpecificationIdLanguageResponses, PutApiCatalogPvtSpecificationBySpecificationIdResponses, PutApiCatalogPvtSpecificationgroupByGroupIdData, PutApiCatalogPvtSpecificationgroupByGroupIdResponses, PutApiCatalogPvtSpecificationgroupBySpecificationGroupIdLanguageData, PutApiCatalogPvtSpecificationgroupBySpecificationGroupIdLanguageErrors, PutApiCatalogPvtSpecificationgroupBySpecificationGroupIdLanguageResponses, PutApiCatalogPvtSpecificationvalueBySpecificationValueIdData, PutApiCatalogPvtSpecificationvalueBySpecificationValueIdResponses, PutApiCatalogPvtSpecificationvalueByValueIdLanguageData, PutApiCatalogPvtSpecificationvalueByValueIdLanguageErrors, PutApiCatalogPvtSpecificationvalueByValueIdLanguageResponses, PutApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdData, PutApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdErrors, PutApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdLanguageData, PutApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdLanguageErrors, PutApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdLanguageResponses, PutApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdResponses, PutApiCatalogPvtStockkeepingunitBySkuIdData, PutApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdData, PutApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdLanguageData, PutApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdLanguageErrors, PutApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdLanguageResponses, PutApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdResponses, PutApiCatalogPvtStockkeepingunitBySkuIdFileReorderData, PutApiCatalogPvtStockkeepingunitBySkuIdFileReorderErrors, PutApiCatalogPvtStockkeepingunitBySkuIdFileReorderResponses, PutApiCatalogPvtStockkeepingunitBySkuIdLanguageData, PutApiCatalogPvtStockkeepingunitBySkuIdLanguageErrors, PutApiCatalogPvtStockkeepingunitBySkuIdLanguageResponses, PutApiCatalogPvtStockkeepingunitBySkuIdResponses, PutApiCatalogPvtStockkeepingunitBySkuIdSpecificationData, PutApiCatalogPvtStockkeepingunitBySkuIdSpecificationResponses, PutApiCatalogPvtStockkeepingunitBySkuIdSpecificationvalueData, PutApiCatalogPvtStockkeepingunitBySkuIdSpecificationvalueResponses, PutApiCatalogPvtStockkeepingunitCopyBySkuIdfromBySkuIdtoFileData, PutApiCatalogPvtStockkeepingunitCopyBySkuIdfromBySkuIdtoFileResponses, PutApiCatalogPvtSubcollectionBySubCollectionIdData, PutApiCatalogPvtSubcollectionBySubCollectionIdResponses, PutApiCatalogPvtSupplierBySupplierIdData, PutApiCatalogPvtSupplierBySupplierIdResponses, SalesChannelbyIdData, SalesChannelbyIdResponses, SalesChannelListData, SalesChannelListResponses, SellerListData, SellerListResponses, SkubyAlternateIdData, SkubyAlternateIdResponses, SkubyEanData, SkubyEanResponses, SkuContextData, SkuContextResponses, SkuData, SkuIdbyRefIdData, SkuIdbyRefIdResponses, SkuIdlistbyRefIdlistData, SkuIdlistbyRefIdlistErrors, SkuIdlistbyRefIdlistResponses, SkulistbyProductIdData, SkulistbyProductIdResponses, SkuResponses, SpecificationGroupInsert2Data, SpecificationGroupInsert2Responses, SpecificationsByCategoryIdData, SpecificationsByCategoryIdResponses, SpecificationsFieldData, SpecificationsFieldResponses, SpecificationsGetFieldValueData, SpecificationsGetFieldValueResponses, SpecificationsGroupGetData, SpecificationsGroupGetResponses, SpecificationsGroupListbyCategoryData, SpecificationsGroupListbyCategoryResponses, SpecificationsInsertFieldData, SpecificationsInsertFieldResponses, SpecificationsInsertFieldUpdateData, SpecificationsInsertFieldUpdateResponses, SpecificationsInsertFieldValueData, SpecificationsInsertFieldValueResponses, SpecificationsTreeByCategoryIdData, SpecificationsTreeByCategoryIdResponses, SpecificationsUpdateFieldValueData, SpecificationsUpdateFieldValueResponses, SpecificationsValuesByFieldIdData, SpecificationsValuesByFieldIdResponses, UpdateProductSpecificationData, UpdateProductSpecificationResponses, UpdateSellerData, UpdateSellerResponses } from './types.gen'; export type Options = Options2 & { /** @@ -4668,12 +4668,12 @@ export const getGiftList = (options: Optio /** * Get product translation by product ID * - * > ℹ️ This feature is in beta, which means that we are working to improve it. If you have any questions, please contact our [Support](https://supporticket.vtex.com/support). - * * Retrieves language-specific information for a product and its associated entities, including categories, brand information, and specifications. Only fields and entities that have valid translations in the requested language are returned. * * To get translations for a given language, you can filter results using the `locale` query parameter. * + * > ℹ️ Learn more in the [Catalog multi-language integration guide](https://developers.vtex.com/docs/guides/catalog-multi-language-integration-guide). + * * ## Permissions * * Any user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: @@ -4695,10 +4695,10 @@ export const getApiCatalogPvtProductByProductIdLanguage = ℹ️ This feature is in beta, which means that we are working to improve it. If you have any questions, please contact our [Support](https://supporticket.vtex.com/support). - * * Inserts or updates language-specific information for a product by its ID. * + * > ℹ️ Learn more in the [Catalog multi-language integration guide](https://developers.vtex.com/docs/guides/catalog-multi-language-integration-guide). + * * ## Permissions * * Any user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: @@ -4720,10 +4720,10 @@ export const putApiCatalogPvtProductByProductIdLanguage = ℹ️ This feature is in beta, which means that we are working to improve it. If you have any questions, please contact our [Support](https://supporticket.vtex.com/support). - * * Retrieves language-specific information for a product specification searching by product ID. * + * > ℹ️ Learn more in the [Catalog multi-language integration guide](https://developers.vtex.com/docs/guides/catalog-multi-language-integration-guide). + * * ## Permissions * * Any user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: @@ -4745,10 +4745,10 @@ export const getApiCatalogPvtProductsByProductIdSpecificationBySpecificationIdLa /** * Create or update product specification translation by product ID * - * > ℹ️ This feature is in beta, which means that we are working to improve it. If you have any questions, please contact our [Support](https://supporticket.vtex.com/support). - * * Inserts or updates language-specific information for a given product specification searching by product ID. * + * > ℹ️ Learn more in the [Catalog multi-language integration guide](https://developers.vtex.com/docs/guides/catalog-multi-language-integration-guide). + * * ## Permissions * * Any user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: @@ -4770,10 +4770,10 @@ export const putApiCatalogPvtProductsByProductIdSpecificationBySpecificationIdLa /** * Get SKU translation by SKU ID * - * > ℹ️ This feature is in beta, which means that we are working to improve it. If you have any questions, please contact our [Support](https://supporticket.vtex.com/support). - * * Retrieves language-specific information for a SKU by its ID. * + * > ℹ️ Learn more in the [Catalog multi-language integration guide](https://developers.vtex.com/docs/guides/catalog-multi-language-integration-guide). + * * ## Permissions * * Any user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: @@ -4795,10 +4795,10 @@ export const getApiCatalogPvtStockkeepingunitBySkuIdLanguage = ℹ️ This feature is in beta, which means that we are working to improve it. If you have any questions, please contact our [Support](https://supporticket.vtex.com/support). - * * Inserts or updates language-specific information for a SKU by its ID. * + * > ℹ️ Learn more in the [Catalog multi-language integration guide](https://developers.vtex.com/docs/guides/catalog-multi-language-integration-guide). + * * ## Permissions * * Any user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: @@ -4820,10 +4820,10 @@ export const putApiCatalogPvtStockkeepingunitBySkuIdLanguage = ℹ️ This feature is in beta, which means that we are working to improve it. If you have any questions, please contact our [Support](https://supporticket.vtex.com/support). - * * Retrieves language-specific information for a SKU attribute searching by SKU ID. * + * > ℹ️ Learn more in the [Catalog multi-language integration guide](https://developers.vtex.com/docs/guides/catalog-multi-language-integration-guide). + * * ## Permissions * * Any user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: @@ -4845,10 +4845,10 @@ export const getApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdLan /** * Create or update SKU attribute translation by SKU ID * - * > ℹ️ This feature is in beta, which means that we are working to improve it. If you have any questions, please contact our [Support](https://supporticket.vtex.com/support). - * * Inserts or updates language-specific information for a SKU attribute searching by SKU ID. * + * > ℹ️ Learn more in the [Catalog multi-language integration guide](https://developers.vtex.com/docs/guides/catalog-multi-language-integration-guide). + * * ## Permissions * * Any user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: @@ -4870,10 +4870,10 @@ export const putApiCatalogPvtStockkeepingunitBySkuIdAttributeBySkuAttributeIdLan /** * Get SKU file translation by SKU ID * - * > ℹ️ This feature is in beta, which means that we are working to improve it. If you have any questions, please contact our [Support](https://supporticket.vtex.com/support). - * * Retrieves language-specific information for a SKU file searching by SKU ID. * + * > ℹ️ Learn more in the [Catalog multi-language integration guide](https://developers.vtex.com/docs/guides/catalog-multi-language-integration-guide). + * * ## Permissions * * Any user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: @@ -4895,10 +4895,10 @@ export const getApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdLanguage = ℹ️ This feature is in beta, which means that we are working to improve it. If you have any questions, please contact our [Support](https://supporticket.vtex.com/support). - * * Inserts or updates language-specific information for a SKU file searching by SKU ID. * + * > ℹ️ Learn more in the [Catalog multi-language integration guide](https://developers.vtex.com/docs/guides/catalog-multi-language-integration-guide). + * * ## Permissions * * Any user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: @@ -4920,10 +4920,10 @@ export const putApiCatalogPvtStockkeepingunitBySkuIdFileBySkuFileIdLanguage = ℹ️ This feature is in beta, which means that we are working to improve it. If you have any questions, please contact our [Support](https://supporticket.vtex.com/support). - * * Retrieves language-specific information for a specification group by its ID. * + * > ℹ️ Learn more in the [Catalog multi-language integration guide](https://developers.vtex.com/docs/guides/catalog-multi-language-integration-guide). + * * ## Permissions * * Any user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: @@ -4945,10 +4945,10 @@ export const getApiCatalogPvtSpecificationgroupBySpecificationGroupIdLanguage = /** * Create or update specification group translation * - * > ℹ️ This feature is in beta, which means that we are working to improve it. If you have any questions, please contact our [Support](https://supporticket.vtex.com/support). - * * Inserts or updates language-specific information for a specification group by its ID. * + * > ℹ️ Learn more in the [Catalog multi-language integration guide](https://developers.vtex.com/docs/guides/catalog-multi-language-integration-guide). + * * ## Permissions * * Any user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: @@ -4970,10 +4970,10 @@ export const putApiCatalogPvtSpecificationgroupBySpecificationGroupIdLanguage = /** * Get specification translation * - * > ℹ️ This feature is in beta, which means that we are working to improve it. If you have any questions, please contact our [Support](https://supporticket.vtex.com/support). - * * Retrieves language-specific information for a specification by its ID. * + * > ℹ️ Learn more in the [Catalog multi-language integration guide](https://developers.vtex.com/docs/guides/catalog-multi-language-integration-guide). + * * ## Permissions * * Any user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: @@ -4995,10 +4995,10 @@ export const getApiCatalogPvtSpecificationBySpecificationIdLanguage = ℹ️ This feature is in beta, which means that we are working to improve it. If you have any questions, please contact our [Support](https://supporticket.vtex.com/support). - * * Inserts or updates language-specific information for a specification by its ID. * + * > ℹ️ Learn more in the [Catalog multi-language integration guide](https://developers.vtex.com/docs/guides/catalog-multi-language-integration-guide). + * * ## Permissions * * Any user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: @@ -5020,10 +5020,10 @@ export const putApiCatalogPvtSpecificationBySpecificationIdLanguage = ℹ️ This feature is in beta, which means that we are working to improve it. If you have any questions, please contact our [Support](https://supporticket.vtex.com/support). - * * Retrieves language-specific information for a specification value by its ID. * + * > ℹ️ Learn more in the [Catalog multi-language integration guide](https://developers.vtex.com/docs/guides/catalog-multi-language-integration-guide). + * * ## Permissions * * Any user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: @@ -5045,10 +5045,10 @@ export const getApiCatalogPvtSpecificationvalueByValueIdLanguage = ℹ️ This feature is in beta, which means that we are working to improve it. If you have any questions, please contact our [Support](https://supporticket.vtex.com/support). - * * Inserts or updates language-specific information for a specification value by its ID. * + * > ℹ️ Learn more in the [Catalog multi-language integration guide](https://developers.vtex.com/docs/guides/catalog-multi-language-integration-guide). + * * ## Permissions * * Any user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: @@ -5070,10 +5070,10 @@ export const putApiCatalogPvtSpecificationvalueByValueIdLanguage = ℹ️ This feature is in beta, which means that we are working to improve it. If you have any questions, please contact our [Support](https://supporticket.vtex.com/support). - * * Retrieves language-specific information for a given category. * + * > ℹ️ Learn more in the [Catalog multi-language integration guide](https://developers.vtex.com/docs/guides/catalog-multi-language-integration-guide). + * * ## Permissions * * Any user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: @@ -5095,10 +5095,10 @@ export const getApiCatalogPvtCategoryByCategoryIdLanguage = ℹ️ This feature is in beta, which means that we are working to improve it. If you have any questions, please contact our [Support](https://supporticket.vtex.com/support). - * * Inserts or updates language-specific information for a category by its ID. * + * > ℹ️ Learn more in the [Catalog multi-language integration guide](https://developers.vtex.com/docs/guides/catalog-multi-language-integration-guide). + * * ## Permissions * * Any user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: @@ -5120,10 +5120,10 @@ export const putApiCatalogPvtCategoryByCategoryIdLanguage = ℹ️ This feature is in beta, which means that we are working to improve it. If you have any questions, please contact our [Support](https://supporticket.vtex.com/support). - * * Retrieves language-specific information for a brand by its ID. * + * > ℹ️ Learn more in the [Catalog multi-language integration guide](https://developers.vtex.com/docs/guides/catalog-multi-language-integration-guide). + * * ## Permissions * * Any user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: @@ -5145,10 +5145,10 @@ export const getApiCatalogPvtBrandByBrandIdLanguage = ℹ️ This feature is in beta, which means that we are working to improve it. If you have any questions, please contact our [Support](https://supporticket.vtex.com/support). - * * Inserts or updates language-specific information for a brand by its ID. * + * > ℹ️ Learn more in the [Catalog multi-language integration guide](https://developers.vtex.com/docs/guides/catalog-multi-language-integration-guide). + * * ## Permissions * * Any user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: @@ -5170,10 +5170,10 @@ export const putApiCatalogPvtBrandByBrandIdLanguage = ℹ️ This feature is in beta, which means that we are working to improve it. If you have any questions, please contact our [Support](https://supporticket.vtex.com/support). - * * Retrieves language-specific information for an attachment by its ID. * + * > ℹ️ Learn more in the [Catalog multi-language integration guide](https://developers.vtex.com/docs/guides/catalog-multi-language-integration-guide). + * * ## Permissions * * Any user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: @@ -5195,10 +5195,10 @@ export const getApiCatalogPvtAttachmentByAttachmentIdLanguage = ℹ️ This feature is in beta, which means that we are working to improve it. If you have any questions, please contact our [Support](https://supporticket.vtex.com/support). - * * Inserts or updates language-specific information for an attachment by its ID. * + * > ℹ️ Learn more in the [Catalog multi-language integration guide](https://developers.vtex.com/docs/guides/catalog-multi-language-integration-guide). + * * ## Permissions * * Any user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: @@ -5220,10 +5220,10 @@ export const putApiCatalogPvtAttachmentByAttachmentIdLanguage = ℹ️ This feature is in beta, which means that we are working to improve it. If you have any questions, please contact our [Support](https://supporticket.vtex.com/support). - * * Retrieves language-specific information for a SKU service type by its ID. * + * > ℹ️ Learn more in the [Catalog multi-language integration guide](https://developers.vtex.com/docs/guides/catalog-multi-language-integration-guide). + * * ## Permissions * * Any user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: @@ -5245,10 +5245,10 @@ export const getApiCatalogPvtSkuservicetypeBySkuServiceTypeIdLanguage = ℹ️ This feature is in beta, which means that we are working to improve it. If you have any questions, please contact our [Support](https://supporticket.vtex.com/support). - * * Inserts or updates language-specific information for a SKU service type by its ID. * + * > ℹ️ Learn more in the [Catalog multi-language integration guide](https://developers.vtex.com/docs/guides/catalog-multi-language-integration-guide). + * * ## Permissions * * Any user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: @@ -5270,10 +5270,10 @@ export const putApiCatalogPvtSkuservicetypeBySkuServiceTypeIdLanguage = ℹ️ This feature is in beta, which means that we are working to improve it. If you have any questions, please contact our [Support](https://supporticket.vtex.com/support). - * * Retrieves language-specific information for a given SKU service by its ID. * + * > ℹ️ Learn more in the [Catalog multi-language integration guide](https://developers.vtex.com/docs/guides/catalog-multi-language-integration-guide). + * * ## Permissions * * Any user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: @@ -5295,10 +5295,10 @@ export const getApiCatalogPvtSkuserviceBySkuserviceIdLanguage = ℹ️ This feature is in beta, which means that we are working to improve it. If you have any questions, please contact our [Support](https://supporticket.vtex.com/support). - * * Inserts or updates language-specific information for a SKU service by its ID. * + * > ℹ️ Learn more in the [Catalog multi-language integration guide](https://developers.vtex.com/docs/guides/catalog-multi-language-integration-guide). + * * ## Permissions * * Any user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: @@ -5320,10 +5320,10 @@ export const putApiCatalogPvtSkuserviceBySkuserviceIdLanguage = ℹ️ This feature is in beta, which means that we are working to improve it. If you have any questions, please contact our [Support](https://supporticket.vtex.com/support). - * * Retrieves language-specific information for a SKU service value by its ID. * + * > ℹ️ Learn more in the [Catalog multi-language integration guide](https://developers.vtex.com/docs/guides/catalog-multi-language-integration-guide). + * * ## Permissions * * Any user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: @@ -5345,10 +5345,10 @@ export const getApiCatalogPvtSkuservicevalueBySkuServiceValueIdLanguage = ℹ️ This feature is in beta, which means that we are working to improve it. If you have any questions, please contact our [Support](https://supporticket.vtex.com/support). - * * Inserts or updates language-specific information for a SKU service value by its ID. * + * > ℹ️ Learn more in the [Catalog multi-language integration guide](https://developers.vtex.com/docs/guides/catalog-multi-language-integration-guide). + * * ## Permissions * * Any user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: @@ -5370,10 +5370,10 @@ export const putApiCatalogPvtSkuservicevalueBySkuServiceValueIdLanguage = ℹ️ This feature is in beta, which means that we are working to improve it. If you have any questions, please contact our [Support](https://supporticket.vtex.com/support). - * * Retrieves language-specific information for a collection by its ID. * + * > ℹ️ Learn more in the [Catalog multi-language integration guide](https://developers.vtex.com/docs/guides/catalog-multi-language-integration-guide). + * * ## Permissions * * Any user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: @@ -5395,10 +5395,10 @@ export const getApiCatalogPvtCollectionByCollectionIdLanguage = ℹ️ This feature is in beta, which means that we are working to improve it. If you have any questions, please contact our [Support](https://supporticket.vtex.com/support). - * * Inserts or updates language-specific information for a collection by its ID. * + * > ℹ️ Learn more in the [Catalog multi-language integration guide](https://developers.vtex.com/docs/guides/catalog-multi-language-integration-guide). + * * ## Permissions * * Any user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: @@ -5416,3 +5416,297 @@ export const putApiCatalogPvtCollectionByCollectionIdLanguage = ⚠️ This feature is only available for stores using the B2B Buyer Portal, which is currently available to select accounts. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise, they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --- | ----- | ----- | + * | Catalog | Content | **Product and SKU Management** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. + * + * To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication-overview#machine-authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const getApiCatalogPvtAssortment = (options: Options) => (options.client ?? client).get({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/catalog/pvt/assortment', + ...options +}); + +/** + * Create product assortment + * + * Creates a new product assortment at the merchant level. The `name` field must be unique across the merchant's assortments. + * + * The assortment is created empty, without included or excluded collections, which can later be added through the [Add included collection to product assortment](https://developers.vtex.com/docs/api-reference/assortments-api#post-/api/catalog/pvt/assortment/-productAssortmentID-/included-collections/-collectionID-) and [Add excluded collection to product assortment](https://developers.vtex.com/docs/api-reference/assortments-api#post-/api/catalog/pvt/assortment/-productAssortmentID-/excluded-collections/-collectionID-) endpoints. + * + * >⚠️ This feature is only available for stores using the B2B Buyer Portal, which is currently available to select accounts. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise, they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --- | ----- | ----- | + * | Catalog | Content | **Product and SKU Management** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. + * + * To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication-overview#machine-authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const postApiCatalogPvtAssortment = (options: Options) => (options.client ?? client).post({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/catalog/pvt/assortment', + ...options +}); + +/** + * Delete product assortment + * + * Deletes a product assortment given its unique identifier. + * + * >❗ Deleting an assortment does not automatically remove its reference from contracts or Organizational Unit scopes (`assortmentIds`). Make sure to remove those references before or after deletion to avoid orphaned references. + * + * >⚠️ This feature is only available for stores using the B2B Buyer Portal, which is currently available to select accounts. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise, they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --- | ----- | ----- | + * | Catalog | Content | **Product and SKU Management** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. + * + * To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication-overview#machine-authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const deleteApiCatalogPvtAssortmentByProductAssortmentId = (options: Options) => (options.client ?? client).delete({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/catalog/pvt/assortment/{productAssortmentID}', + ...options +}); + +/** + * Get product assortment by ID + * + * Retrieves the details of a product assortment given its unique identifier, including the list of included and excluded collections. + * + * >⚠️ This feature is only available for stores using the B2B Buyer Portal, which is currently available to select accounts. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise, they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --- | ----- | ----- | + * | Catalog | Content | **Product and SKU Management** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. + * + * To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication-overview#machine-authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const getApiCatalogPvtAssortmentByProductAssortmentId = (options: Options) => (options.client ?? client).get({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/catalog/pvt/assortment/{productAssortmentID}', + ...options +}); + +/** + * Update product assortment + * + * Updates the `name` of an existing product assortment given its unique identifier. The new `name` must be unique across the merchant's assortments. + * + * >⚠️ This feature is only available for stores using the B2B Buyer Portal, which is currently available to select accounts. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise, they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --- | ----- | ----- | + * | Catalog | Content | **Product and SKU Management** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. + * + * To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication-overview#machine-authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const putApiCatalogPvtAssortmentByProductAssortmentId = (options: Options) => (options.client ?? client).put({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/catalog/pvt/assortment/{productAssortmentID}', + ...options +}); + +/** + * Remove included collection from product assortment + * + * Removes a collection from the included collections list of the specified product assortment. + * + * >⚠️ This feature is only available for stores using the B2B Buyer Portal, which is currently available to select accounts. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise, they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --- | ----- | ----- | + * | Catalog | Content | **Product and SKU Management** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. + * + * To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication-overview#machine-authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const deleteApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionId = (options: Options) => (options.client ?? client).delete({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/catalog/pvt/assortment/{productAssortmentID}/included-collections/{collectionID}', + ...options +}); + +/** + * Add included collection to product assortment + * + * Associates a collection as an included collection of the specified product assortment. Included collections define the SKUs that must be explicitly allowed when the inclusion model is applied to the catalog segmentation. + * + * The same collection cannot be associated twice with the same assortment. In that case, the request will return a status code `409` error. + * + * >⚠️ This feature is only available for stores using the B2B Buyer Portal, which is currently available to select accounts. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise, they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --- | ----- | ----- | + * | Catalog | Content | **Product and SKU Management** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. + * + * To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication-overview#machine-authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const postApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionId = (options: Options) => (options.client ?? client).post({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/catalog/pvt/assortment/{productAssortmentID}/included-collections/{collectionID}', + ...options +}); + +/** + * Remove excluded collection from product assortment + * + * Removes a collection from the excluded collections list of the specified product assortment. + * + * >⚠️ This feature is only available for stores using the B2B Buyer Portal, which is currently available to select accounts. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise, they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --- | ----- | ----- | + * | Catalog | Content | **Product and SKU Management** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. + * + * To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication-overview#machine-authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const deleteApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionId = (options: Options) => (options.client ?? client).delete({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/catalog/pvt/assortment/{productAssortmentID}/excluded-collections/{collectionID}', + ...options +}); + +/** + * Add excluded collection to product assortment + * + * Associates a collection as an excluded collection of the specified product assortment. Excluded collections define the SKUs that must be hidden when the exclusion model is applied to the catalog segmentation. + * + * The same collection cannot be associated twice with the same assortment. In that case, the request will return a status code `409` error. + * + * >⚠️ This feature is only available for stores using the B2B Buyer Portal, which is currently available to select accounts. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise, they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --- | ----- | ----- | + * | Catalog | Content | **Product and SKU Management** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. + * + * To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication-overview#machine-authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const postApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionId = (options: Options) => (options.client ?? client).post({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/catalog/pvt/assortment/{productAssortmentID}/excluded-collections/{collectionID}', + ...options +}); diff --git a/vtex/server/generated/catalog/types.gen.ts b/vtex/server/generated/catalog/types.gen.ts index 92050195..6dae999a 100644 --- a/vtex/server/generated/catalog/types.gen.ts +++ b/vtex/server/generated/catalog/types.gen.ts @@ -1986,6 +1986,60 @@ export type SupplierResponse = { IsActive?: boolean; }; +/** + * Object with information about a product assortment. + */ +export type ProductAssortment = { + /** + * Assortment's unique numerical identifier. + */ + Id?: number; + /** + * Assortment's unique name. + */ + Name?: string; + /** + * Date and time when the assortment was created, in UTC format. + */ + CreatedAt?: string; + /** + * Date and time when the assortment was last updated, in UTC format. + */ + UpdatedAt?: string; + /** + * List of collection IDs explicitly allowed by the assortment. + */ + IncludedCollections?: Array; + /** + * List of collection IDs explicitly restricted by the assortment. + */ + ExcludedCollections?: Array; +}; + +/** + * Object with information about the association between an assortment and a collection. + */ +export type AssortmentCollectionAssociation = { + /** + * Assortment's unique identifier. + */ + assortmentId?: number; + /** + * Collection's unique identifier associated with the assortment. + */ + collectionId?: number; +}; + +/** + * Object with information about the error. + */ +export type ErrorResponse = { + /** + * Error message describing the reason the request failed. + */ + Message?: string; +}; + /** * Type of the content being sent. */ @@ -2076,6 +2130,16 @@ export type SkuServiceValueId = number; */ export type Locale = string; +/** + * Product assortment's unique numerical identifier. + */ +export type ProductAssortmentId = number; + +/** + * Collection's unique numerical identifier. + */ +export type CollectionId2 = number; + export type ProductAndSkuIdsData = { body?: never; headers: { @@ -5346,7 +5410,7 @@ export type PutApiCatalogPvtStockkeepingunitBySkuIdFileReorderErrors = { export type PutApiCatalogPvtStockkeepingunitBySkuIdFileReorderResponses = { /** - * OK. + * OK */ 200: unknown; }; @@ -14517,3 +14581,411 @@ export type PutApiCatalogPvtCollectionByCollectionIdLanguageResponses = { */ 201: unknown; }; + +export type GetApiCatalogPvtAssortmentData = { + body?: never; + headers: { + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path?: never; + query?: { + /** + * Assortment name. + */ + name?: string; + /** + * Cursor indicating the assortment ID after which the next page of results must start. Useful for cursor-based pagination. + */ + after?: number; + /** + * Maximum number of assortments returned in the response when using cursor-based pagination. + */ + size?: number; + /** + * Filters the result to return only assortments that reference the specified collection ID, either as an included or as an excluded collection. + */ + collectionId?: number; + }; + url: '/api/catalog/pvt/assortment'; +}; + +export type GetApiCatalogPvtAssortmentResponses = { + /** + * OK + */ + 200: { + /** + * Total number of assortments available at the merchant level. + */ + TotalRows?: number; + /** + * List of assortments returned in the current page. + */ + Data?: Array<{ + /** + * Assortment's unique numerical identifier. + */ + Id?: number; + /** + * Assortment's unique name. + */ + Name?: string; + /** + * Date and time when the assortment was created, in UTC format. + */ + CreatedAt?: string; + /** + * Date and time when the assortment was last updated, in UTC format. + */ + UpdatedAt?: string; + /** + * List of collection IDs explicitly allowed by the assortment. + */ + IncludedCollections?: Array; + /** + * List of collection IDs explicitly restricted by the assortment. + */ + ExcludedCollections?: Array; + }>; + /** + * Number of assortments returned in the current page. + */ + Size?: number; + }; +}; + +export type GetApiCatalogPvtAssortmentResponse = GetApiCatalogPvtAssortmentResponses[keyof GetApiCatalogPvtAssortmentResponses]; + +export type PostApiCatalogPvtAssortmentData = { + body?: { + /** + * Assortment's unique name at the merchant level. + */ + name: string; + }; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path?: never; + query?: never; + url: '/api/catalog/pvt/assortment'; +}; + +export type PostApiCatalogPvtAssortmentErrors = { + /** + * Unprocessable Entity + */ + 422: ErrorResponse; +}; + +export type PostApiCatalogPvtAssortmentError = PostApiCatalogPvtAssortmentErrors[keyof PostApiCatalogPvtAssortmentErrors]; + +export type PostApiCatalogPvtAssortmentResponses = { + /** + * Created + */ + 201: ProductAssortment; +}; + +export type PostApiCatalogPvtAssortmentResponse = PostApiCatalogPvtAssortmentResponses[keyof PostApiCatalogPvtAssortmentResponses]; + +export type DeleteApiCatalogPvtAssortmentByProductAssortmentIdData = { + body?: never; + headers: { + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path: { + /** + * Product assortment's unique numerical identifier. + */ + productAssortmentID: number; + }; + query?: never; + url: '/api/catalog/pvt/assortment/{productAssortmentID}'; +}; + +export type DeleteApiCatalogPvtAssortmentByProductAssortmentIdErrors = { + /** + * Bad Request + */ + 400: ErrorResponse; + /** + * Not Found + */ + 404: ErrorResponse; +}; + +export type DeleteApiCatalogPvtAssortmentByProductAssortmentIdError = DeleteApiCatalogPvtAssortmentByProductAssortmentIdErrors[keyof DeleteApiCatalogPvtAssortmentByProductAssortmentIdErrors]; + +export type DeleteApiCatalogPvtAssortmentByProductAssortmentIdResponses = { + /** + * Empty response body returned upon successful deletion. + */ + 200: { + [key: string]: unknown; + }; +}; + +export type DeleteApiCatalogPvtAssortmentByProductAssortmentIdResponse = DeleteApiCatalogPvtAssortmentByProductAssortmentIdResponses[keyof DeleteApiCatalogPvtAssortmentByProductAssortmentIdResponses]; + +export type GetApiCatalogPvtAssortmentByProductAssortmentIdData = { + body?: never; + headers: { + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path: { + /** + * Product assortment's unique numerical identifier. + */ + productAssortmentID: number; + }; + query?: never; + url: '/api/catalog/pvt/assortment/{productAssortmentID}'; +}; + +export type GetApiCatalogPvtAssortmentByProductAssortmentIdErrors = { + /** + * Not Found + */ + 404: ErrorResponse; +}; + +export type GetApiCatalogPvtAssortmentByProductAssortmentIdError = GetApiCatalogPvtAssortmentByProductAssortmentIdErrors[keyof GetApiCatalogPvtAssortmentByProductAssortmentIdErrors]; + +export type GetApiCatalogPvtAssortmentByProductAssortmentIdResponses = { + /** + * OK + */ + 200: ProductAssortment; +}; + +export type GetApiCatalogPvtAssortmentByProductAssortmentIdResponse = GetApiCatalogPvtAssortmentByProductAssortmentIdResponses[keyof GetApiCatalogPvtAssortmentByProductAssortmentIdResponses]; + +export type PutApiCatalogPvtAssortmentByProductAssortmentIdData = { + body?: { + /** + * Assortment's new unique name. Must not collide with existing assortments at the merchant level. + */ + name: string; + }; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path: { + /** + * Product assortment's unique numerical identifier. + */ + productAssortmentID: number; + }; + query?: never; + url: '/api/catalog/pvt/assortment/{productAssortmentID}'; +}; + +export type PutApiCatalogPvtAssortmentByProductAssortmentIdErrors = { + /** + * Not Found + */ + 404: ErrorResponse; + /** + * Unprocessable Entity + */ + 422: ErrorResponse; +}; + +export type PutApiCatalogPvtAssortmentByProductAssortmentIdError = PutApiCatalogPvtAssortmentByProductAssortmentIdErrors[keyof PutApiCatalogPvtAssortmentByProductAssortmentIdErrors]; + +export type PutApiCatalogPvtAssortmentByProductAssortmentIdResponses = { + /** + * OK + */ + 200: ProductAssortment; +}; + +export type PutApiCatalogPvtAssortmentByProductAssortmentIdResponse = PutApiCatalogPvtAssortmentByProductAssortmentIdResponses[keyof PutApiCatalogPvtAssortmentByProductAssortmentIdResponses]; + +export type DeleteApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdData = { + body?: never; + headers: { + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path: { + /** + * Product assortment's unique numerical identifier. + */ + productAssortmentID: number; + /** + * Collection's unique numerical identifier. + */ + collectionID: number; + }; + query?: never; + url: '/api/catalog/pvt/assortment/{productAssortmentID}/included-collections/{collectionID}'; +}; + +export type DeleteApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdErrors = { + /** + * Not Found + */ + 404: ErrorResponse; +}; + +export type DeleteApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdError = DeleteApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdErrors[keyof DeleteApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdErrors]; + +export type DeleteApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdResponses = { + /** + * Empty response body returned upon successful removal. + */ + 200: { + [key: string]: unknown; + }; +}; + +export type DeleteApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdResponse = DeleteApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdResponses[keyof DeleteApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdResponses]; + +export type PostApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdData = { + body?: never; + headers: { + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path: { + /** + * Product assortment's unique numerical identifier. + */ + productAssortmentID: number; + /** + * Collection's unique numerical identifier. + */ + collectionID: number; + }; + query?: never; + url: '/api/catalog/pvt/assortment/{productAssortmentID}/included-collections/{collectionID}'; +}; + +export type PostApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdErrors = { + /** + * Conflict + */ + 409: ErrorResponse; +}; + +export type PostApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdError = PostApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdErrors[keyof PostApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdErrors]; + +export type PostApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdResponses = { + /** + * OK + */ + 200: AssortmentCollectionAssociation; +}; + +export type PostApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdResponse = PostApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdResponses[keyof PostApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdResponses]; + +export type DeleteApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdData = { + body?: never; + headers: { + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path: { + /** + * Product assortment's unique numerical identifier. + */ + productAssortmentID: number; + /** + * Collection's unique numerical identifier. + */ + collectionID: number; + }; + query?: never; + url: '/api/catalog/pvt/assortment/{productAssortmentID}/excluded-collections/{collectionID}'; +}; + +export type DeleteApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdErrors = { + /** + * Not Found + */ + 404: ErrorResponse; +}; + +export type DeleteApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdError = DeleteApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdErrors[keyof DeleteApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdErrors]; + +export type DeleteApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdResponses = { + /** + * Empty response body returned upon successful removal. + */ + 200: { + [key: string]: unknown; + }; +}; + +export type DeleteApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdResponse = DeleteApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdResponses[keyof DeleteApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdResponses]; + +export type PostApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdData = { + body?: never; + headers: { + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path: { + /** + * Product assortment's unique numerical identifier. + */ + productAssortmentID: number; + /** + * Collection's unique numerical identifier. + */ + collectionID: number; + }; + query?: never; + url: '/api/catalog/pvt/assortment/{productAssortmentID}/excluded-collections/{collectionID}'; +}; + +export type PostApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdErrors = { + /** + * Conflict + */ + 409: ErrorResponse; +}; + +export type PostApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdError = PostApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdErrors[keyof PostApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdErrors]; + +export type PostApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdResponses = { + /** + * OK + */ + 200: AssortmentCollectionAssociation; +}; + +export type PostApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdResponse = PostApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdResponses[keyof PostApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdResponses]; diff --git a/vtex/server/generated/catalog/zod.gen.ts b/vtex/server/generated/catalog/zod.gen.ts index 3bcf125e..5b7a7539 100644 --- a/vtex/server/generated/catalog/zod.gen.ts +++ b/vtex/server/generated/catalog/zod.gen.ts @@ -825,6 +825,33 @@ export const zSupplierResponse = z.object({ IsActive: z.optional(z.boolean()) }); +/** + * Object with information about a product assortment. + */ +export const zProductAssortment = z.object({ + Id: z.optional(z.int()), + Name: z.optional(z.string()), + CreatedAt: z.optional(z.iso.datetime()), + UpdatedAt: z.optional(z.iso.datetime()), + IncludedCollections: z.optional(z.array(z.int())), + ExcludedCollections: z.optional(z.array(z.int())) +}); + +/** + * Object with information about the association between an assortment and a collection. + */ +export const zAssortmentCollectionAssociation = z.object({ + assortmentId: z.optional(z.int()), + collectionId: z.optional(z.int()) +}); + +/** + * Object with information about the error. + */ +export const zErrorResponse = z.object({ + Message: z.optional(z.string()) +}); + /** * Type of the content being sent. */ @@ -915,6 +942,16 @@ export const zSkuServiceValueId = z.int(); */ export const zLocale = z.string(); +/** + * Product assortment's unique numerical identifier. + */ +export const zProductAssortmentId = z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }); + +/** + * Collection's unique numerical identifier. + */ +export const zCollectionId2 = z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }); + export const zProductAndSkuIdsData = z.object({ body: z.optional(z.never()), path: z.optional(z.never()), @@ -3964,3 +4001,113 @@ export const zPutApiCatalogPvtCollectionByCollectionIdLanguageData = z.object({ Accept: z.string().default('application/json') }) }); + +export const zGetApiCatalogPvtAssortmentData = z.object({ + body: z.optional(z.never()), + path: z.optional(z.never()), + query: z.optional(z.object({ + name: z.optional(z.string()), + after: z.optional(z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' })), + size: z.optional(z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' })), + collectionId: z.optional(z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' })) + })), + headers: z.object({ + Accept: z.string().default('application/json') + }) +}); + +export const zPostApiCatalogPvtAssortmentData = z.object({ + body: z.optional(z.object({ + name: z.string() + })), + path: z.optional(z.never()), + query: z.optional(z.never()), + headers: z.object({ + 'Content-Type': z.string().default('application/json'), + Accept: z.string().default('application/json') + }) +}); + +export const zDeleteApiCatalogPvtAssortmentByProductAssortmentIdData = z.object({ + body: z.optional(z.never()), + path: z.object({ + productAssortmentID: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }) + }), + query: z.optional(z.never()), + headers: z.object({ + Accept: z.string().default('application/json') + }) +}); + +export const zGetApiCatalogPvtAssortmentByProductAssortmentIdData = z.object({ + body: z.optional(z.never()), + path: z.object({ + productAssortmentID: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }) + }), + query: z.optional(z.never()), + headers: z.object({ + Accept: z.string().default('application/json') + }) +}); + +export const zPutApiCatalogPvtAssortmentByProductAssortmentIdData = z.object({ + body: z.optional(z.object({ + name: z.string() + })), + path: z.object({ + productAssortmentID: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }) + }), + query: z.optional(z.never()), + headers: z.object({ + 'Content-Type': z.string().default('application/json'), + Accept: z.string().default('application/json') + }) +}); + +export const zDeleteApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdData = z.object({ + body: z.optional(z.never()), + path: z.object({ + productAssortmentID: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }), + collectionID: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }) + }), + query: z.optional(z.never()), + headers: z.object({ + Accept: z.string().default('application/json') + }) +}); + +export const zPostApiCatalogPvtAssortmentByProductAssortmentIdIncludedCollectionsByCollectionIdData = z.object({ + body: z.optional(z.never()), + path: z.object({ + productAssortmentID: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }), + collectionID: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }) + }), + query: z.optional(z.never()), + headers: z.object({ + Accept: z.string().default('application/json') + }) +}); + +export const zDeleteApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdData = z.object({ + body: z.optional(z.never()), + path: z.object({ + productAssortmentID: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }), + collectionID: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }) + }), + query: z.optional(z.never()), + headers: z.object({ + Accept: z.string().default('application/json') + }) +}); + +export const zPostApiCatalogPvtAssortmentByProductAssortmentIdExcludedCollectionsByCollectionIdData = z.object({ + body: z.optional(z.never()), + path: z.object({ + productAssortmentID: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }), + collectionID: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }) + }), + query: z.optional(z.never()), + headers: z.object({ + Accept: z.string().default('application/json') + }) +}); diff --git a/vtex/server/generated/checkout/index.ts b/vtex/server/generated/checkout/index.ts index 73a45bb1..4fec9c4f 100644 --- a/vtex/server/generated/checkout/index.ts +++ b/vtex/server/generated/checkout/index.ts @@ -1,4 +1,4 @@ // This file is auto-generated by @hey-api/openapi-ts -export { addClientPreferences, addClientProfile, addCoupons, addMarketingData, addMerchantContextData, addPaymentData, addShippingAddress, cartSimulation, clearorderFormMessages, createANewCart, deleteApiCheckoutPubOrderFormByOrderFormIdCustomFieldsItemByItemId, getAddressByPostalCode, getCartInformationById, getCartInstallments, getClientProfileByEmail, getorderFormconfiguration, getSellersByRegion, getWindowToChangeSeller, ignoreProfileData, items, itemsHandle, itemsUpdate, listPickupPpointsByLocation, type Options, placeOrder, placeOrderFromExistingOrderForm, postApiCheckoutPubOrderFormByOrderFormIdAttachmentsInvoiceData, priceChange, processOrder, putApiCheckoutPubOrderFormByOrderFormIdCustomFields, putApiCheckoutPubOrderFormByOrderFormIdCustomFieldsAddressByAddressId, putApiCheckoutPubOrderFormByOrderFormIdCustomFieldsItemByItemId, putApiCheckoutPubOrderFormByOrderFormIdCustomFieldsOrder, removeAllItems, removeallpersonaldata, removesinglecustomfieldvalue, setMultipleCustomFieldValues, setSingleCustomFieldValue, updateorderFormconfiguration, updateWindowToChangeSeller } from './sdk.gen'; -export type { Accept, AddClientPreferencesData, AddClientPreferencesResponse, AddClientPreferencesResponses, AddClientProfileData, AddClientProfileResponse, AddClientProfileResponses, AddCouponsData, AddCouponsResponse, AddCouponsResponses, AddMarketingDataData, AddMarketingDataResponse, AddMarketingDataResponses, AddMerchantContextDataData, AddMerchantContextDataResponse, AddMerchantContextDataResponses, AddPaymentDataData, AddPaymentDataResponse, AddPaymentDataResponses, AddShippingAddressData, AddShippingAddressResponse, AddShippingAddressResponses, CartSimulationData, CartSimulationResponse, CartSimulationResponses, ClearorderFormMessagesData, ClearorderFormMessagesResponse, ClearorderFormMessagesResponses, ClientOptions, ContentType, CreateANewCartData, CreateANewCartResponse, CreateANewCartResponses, DeleteApiCheckoutPubOrderFormByOrderFormIdCustomFieldsItemByItemIdData, DeleteApiCheckoutPubOrderFormByOrderFormIdCustomFieldsItemByItemIdResponse, DeleteApiCheckoutPubOrderFormByOrderFormIdCustomFieldsItemByItemIdResponses, GetAddressByPostalCodeData, GetAddressByPostalCodeResponse, GetAddressByPostalCodeResponses, GetCartInformationByIdData, GetCartInformationByIdResponse, GetCartInformationByIdResponses, GetCartInstallmentsData, GetCartInstallmentsResponse, GetCartInstallmentsResponses, GetClientProfileByEmailData, GetClientProfileByEmailResponse, GetClientProfileByEmailResponses, GetorderFormconfigurationData, GetorderFormconfigurationResponse, GetorderFormconfigurationResponses, GetSellersByRegionData, GetSellersByRegionResponse, GetSellersByRegionResponses, GetWindowToChangeSellerData, GetWindowToChangeSellerResponse, GetWindowToChangeSellerResponses, IgnoreProfileDataData, IgnoreProfileDataResponse, IgnoreProfileDataResponses, IndividualShippingEstimates, Item, ItemsData, ItemsHandleData, ItemsHandleResponse, ItemsHandleResponses, ItemsResponse, ItemsResponses, ItemsUpdateData, ItemsUpdateResponse, ItemsUpdateResponses, ListPickupPpointsByLocationData, ListPickupPpointsByLocationResponse, ListPickupPpointsByLocationResponses, OrderForm, OrderFormSimulationRequest, PaymentConfiguration, PlaceOrderData, PlaceOrderFromExistingOrderFormData, PlaceOrderFromExistingOrderFormResponse, PlaceOrderFromExistingOrderFormResponses, PlaceOrderResponse, PlaceOrderResponses, PostApiCheckoutPubOrderFormByOrderFormIdAttachmentsInvoiceDataData, PostApiCheckoutPubOrderFormByOrderFormIdAttachmentsInvoiceDataResponse, PostApiCheckoutPubOrderFormByOrderFormIdAttachmentsInvoiceDataResponses, PriceChangeData, PriceChangeRequest, PriceChangeResponse, PriceChangeResponses, ProcessOrderData, ProcessOrderError, ProcessOrderErrors, ProcessOrderResponses, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsAddressByAddressIdData, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsAddressByAddressIdResponse, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsAddressByAddressIdResponses, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsData, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsItemByItemIdData, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsItemByItemIdResponse, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsItemByItemIdResponses, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsOrderData, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsOrderResponse, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsOrderResponses, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsResponse, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsResponses, RemoveAllItemsData, RemoveAllItemsResponse, RemoveAllItemsResponses, RemoveallpersonaldataData, RemoveallpersonaldataResponse, RemoveallpersonaldataResponses, RemovesinglecustomfieldvalueData, RemovesinglecustomfieldvalueResponse, RemovesinglecustomfieldvalueResponses, SetMultipleCustomFieldValuesData, SetMultipleCustomFieldValuesResponse, SetMultipleCustomFieldValuesResponses, SetSingleCustomFieldValueData, SetsinglecustomfieldvalueRequest, SetSingleCustomFieldValueResponse, SetSingleCustomFieldValueResponses, UpdateorderFormconfigurationData, UpdateorderFormconfigurationRequest, UpdateorderFormconfigurationResponse, UpdateorderFormconfigurationResponses, UpdateWindowToChangeSellerData, UpdateWindowToChangeSellerResponses, WaitingTime } from './types.gen'; +export { addClientPreferences, addClientProfile, addCoupons, addMarketingData, addMerchantContextData, addPaymentData, addShippingAddress, cartSimulation, clearorderFormMessages, createANewCart, createorderFormconfiguration, deleteApiCheckoutPubOrderFormByOrderFormIdAttachmentsSubscriptionData, deleteApiCheckoutPubOrderFormByOrderFormIdCustomFieldsItemByItemId, deleteApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexAttachmentsByAttachmentName, deleteApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexPrice, getAddressByPostalCode, getCartInformationById, getCartInstallments, getClientProfileByEmail, getorderFormconfiguration, getSellersByRegion, getWindowToChangeSeller, ignoreProfileData, items, itemsHandle, itemsUpdate, listPickupPpointsByLocation, type Options, placeOrder, placeOrderFromExistingOrderForm, postApiCheckoutPubOrderFormByOrderFormIdAttachmentsInvoiceData, postApiCheckoutPubOrderFormByOrderFormIdAttachmentsSubscriptionData, postApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexAttachmentsByAttachmentName, priceChange, processOrder, putApiCheckoutPubOrderFormByOrderFormIdCustomFields, putApiCheckoutPubOrderFormByOrderFormIdCustomFieldsAddressByAddressId, putApiCheckoutPubOrderFormByOrderFormIdCustomFieldsItemByItemId, putApiCheckoutPubOrderFormByOrderFormIdCustomFieldsOrder, removeAllItems, removeallpersonaldata, removesinglecustomfieldvalue, setMultipleCustomFieldValues, setSingleCustomFieldValue, updateorderFormconfiguration, updateWindowToChangeSeller } from './sdk.gen'; +export type { Accept, AddClientPreferencesData, AddClientPreferencesResponse, AddClientPreferencesResponses, AddClientProfileData, AddClientProfileResponse, AddClientProfileResponses, AddCouponsData, AddCouponsResponse, AddCouponsResponses, AddMarketingDataData, AddMarketingDataResponse, AddMarketingDataResponses, AddMerchantContextDataData, AddMerchantContextDataResponse, AddMerchantContextDataResponses, AddPaymentDataData, AddPaymentDataResponse, AddPaymentDataResponses, AddShippingAddressData, AddShippingAddressResponse, AddShippingAddressResponses, CartSimulationData, CartSimulationResponse, CartSimulationResponses, ClearorderFormMessagesData, ClearorderFormMessagesResponse, ClearorderFormMessagesResponses, ClientOptions, ContentType, CreateANewCartData, CreateANewCartResponse, CreateANewCartResponses, CreateorderFormconfigurationData, CreateorderFormconfigurationResponse, CreateorderFormconfigurationResponses, DeleteApiCheckoutPubOrderFormByOrderFormIdAttachmentsSubscriptionDataData, DeleteApiCheckoutPubOrderFormByOrderFormIdAttachmentsSubscriptionDataResponse, DeleteApiCheckoutPubOrderFormByOrderFormIdAttachmentsSubscriptionDataResponses, DeleteApiCheckoutPubOrderFormByOrderFormIdCustomFieldsItemByItemIdData, DeleteApiCheckoutPubOrderFormByOrderFormIdCustomFieldsItemByItemIdResponse, DeleteApiCheckoutPubOrderFormByOrderFormIdCustomFieldsItemByItemIdResponses, DeleteApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexAttachmentsByAttachmentNameData, DeleteApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexAttachmentsByAttachmentNameResponse, DeleteApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexAttachmentsByAttachmentNameResponses, DeleteApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexPriceData, DeleteApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexPriceResponse, DeleteApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexPriceResponses, GetAddressByPostalCodeData, GetAddressByPostalCodeResponse, GetAddressByPostalCodeResponses, GetCartInformationByIdData, GetCartInformationByIdResponse, GetCartInformationByIdResponses, GetCartInstallmentsData, GetCartInstallmentsResponse, GetCartInstallmentsResponses, GetClientProfileByEmailData, GetClientProfileByEmailResponse, GetClientProfileByEmailResponses, GetorderFormconfigurationData, GetorderFormconfigurationResponse, GetorderFormconfigurationResponses, GetSellersByRegionData, GetSellersByRegionResponse, GetSellersByRegionResponses, GetWindowToChangeSellerData, GetWindowToChangeSellerResponse, GetWindowToChangeSellerResponses, IgnoreProfileDataData, IgnoreProfileDataResponse, IgnoreProfileDataResponses, IndividualShippingEstimates, Item, ItemsData, ItemsHandleData, ItemsHandleResponse, ItemsHandleResponses, ItemsResponse, ItemsResponses, ItemsUpdateData, ItemsUpdateResponse, ItemsUpdateResponses, ListPickupPpointsByLocationData, ListPickupPpointsByLocationResponse, ListPickupPpointsByLocationResponses, OrderForm, OrderFormSimulationRequest, PaymentConfiguration, PlaceOrderData, PlaceOrderFromExistingOrderFormData, PlaceOrderFromExistingOrderFormResponse, PlaceOrderFromExistingOrderFormResponses, PlaceOrderResponse, PlaceOrderResponses, PostApiCheckoutPubOrderFormByOrderFormIdAttachmentsInvoiceDataData, PostApiCheckoutPubOrderFormByOrderFormIdAttachmentsInvoiceDataResponse, PostApiCheckoutPubOrderFormByOrderFormIdAttachmentsInvoiceDataResponses, PostApiCheckoutPubOrderFormByOrderFormIdAttachmentsSubscriptionDataData, PostApiCheckoutPubOrderFormByOrderFormIdAttachmentsSubscriptionDataResponse, PostApiCheckoutPubOrderFormByOrderFormIdAttachmentsSubscriptionDataResponses, PostApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexAttachmentsByAttachmentNameData, PostApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexAttachmentsByAttachmentNameResponse, PostApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexAttachmentsByAttachmentNameResponses, PriceChangeData, PriceChangeRequest, PriceChangeResponse, PriceChangeResponses, ProcessOrderData, ProcessOrderError, ProcessOrderErrors, ProcessOrderResponses, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsAddressByAddressIdData, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsAddressByAddressIdResponse, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsAddressByAddressIdResponses, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsData, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsItemByItemIdData, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsItemByItemIdResponse, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsItemByItemIdResponses, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsOrderData, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsOrderResponse, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsOrderResponses, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsResponse, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsResponses, RemoveAllItemsData, RemoveAllItemsResponse, RemoveAllItemsResponses, RemoveallpersonaldataData, RemoveallpersonaldataResponse, RemoveallpersonaldataResponses, RemovesinglecustomfieldvalueData, RemovesinglecustomfieldvalueResponse, RemovesinglecustomfieldvalueResponses, SetMultipleCustomFieldValuesData, SetMultipleCustomFieldValuesResponse, SetMultipleCustomFieldValuesResponses, SetSingleCustomFieldValueData, SetsinglecustomfieldvalueRequest, SetSingleCustomFieldValueResponse, SetSingleCustomFieldValueResponses, UpdateorderFormconfigurationData, UpdateorderFormconfigurationRequest, UpdateorderFormconfigurationResponse, UpdateorderFormconfigurationResponses, UpdateWindowToChangeSellerData, UpdateWindowToChangeSellerResponses, WaitingTime } from './types.gen'; diff --git a/vtex/server/generated/checkout/sdk.gen.ts b/vtex/server/generated/checkout/sdk.gen.ts index b02f86d4..9043b03c 100644 --- a/vtex/server/generated/checkout/sdk.gen.ts +++ b/vtex/server/generated/checkout/sdk.gen.ts @@ -2,7 +2,7 @@ import type { Client, Options as Options2, TDataShape } from './client'; import { client } from './client.gen'; -import type { AddClientPreferencesData, AddClientPreferencesResponses, AddClientProfileData, AddClientProfileResponses, AddCouponsData, AddCouponsResponses, AddMarketingDataData, AddMarketingDataResponses, AddMerchantContextDataData, AddMerchantContextDataResponses, AddPaymentDataData, AddPaymentDataResponses, AddShippingAddressData, AddShippingAddressResponses, CartSimulationData, CartSimulationResponses, ClearorderFormMessagesData, ClearorderFormMessagesResponses, CreateANewCartData, CreateANewCartResponses, DeleteApiCheckoutPubOrderFormByOrderFormIdCustomFieldsItemByItemIdData, DeleteApiCheckoutPubOrderFormByOrderFormIdCustomFieldsItemByItemIdResponses, GetAddressByPostalCodeData, GetAddressByPostalCodeResponses, GetCartInformationByIdData, GetCartInformationByIdResponses, GetCartInstallmentsData, GetCartInstallmentsResponses, GetClientProfileByEmailData, GetClientProfileByEmailResponses, GetorderFormconfigurationData, GetorderFormconfigurationResponses, GetSellersByRegionData, GetSellersByRegionResponses, GetWindowToChangeSellerData, GetWindowToChangeSellerResponses, IgnoreProfileDataData, IgnoreProfileDataResponses, ItemsData, ItemsHandleData, ItemsHandleResponses, ItemsResponses, ItemsUpdateData, ItemsUpdateResponses, ListPickupPpointsByLocationData, ListPickupPpointsByLocationResponses, PlaceOrderData, PlaceOrderFromExistingOrderFormData, PlaceOrderFromExistingOrderFormResponses, PlaceOrderResponses, PostApiCheckoutPubOrderFormByOrderFormIdAttachmentsInvoiceDataData, PostApiCheckoutPubOrderFormByOrderFormIdAttachmentsInvoiceDataResponses, PriceChangeData, PriceChangeResponses, ProcessOrderData, ProcessOrderErrors, ProcessOrderResponses, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsAddressByAddressIdData, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsAddressByAddressIdResponses, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsData, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsItemByItemIdData, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsItemByItemIdResponses, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsOrderData, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsOrderResponses, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsResponses, RemoveAllItemsData, RemoveAllItemsResponses, RemoveallpersonaldataData, RemoveallpersonaldataResponses, RemovesinglecustomfieldvalueData, RemovesinglecustomfieldvalueResponses, SetMultipleCustomFieldValuesData, SetMultipleCustomFieldValuesResponses, SetSingleCustomFieldValueData, SetSingleCustomFieldValueResponses, UpdateorderFormconfigurationData, UpdateorderFormconfigurationResponses, UpdateWindowToChangeSellerData, UpdateWindowToChangeSellerResponses } from './types.gen'; +import type { AddClientPreferencesData, AddClientPreferencesResponses, AddClientProfileData, AddClientProfileResponses, AddCouponsData, AddCouponsResponses, AddMarketingDataData, AddMarketingDataResponses, AddMerchantContextDataData, AddMerchantContextDataResponses, AddPaymentDataData, AddPaymentDataResponses, AddShippingAddressData, AddShippingAddressResponses, CartSimulationData, CartSimulationResponses, ClearorderFormMessagesData, ClearorderFormMessagesResponses, CreateANewCartData, CreateANewCartResponses, CreateorderFormconfigurationData, CreateorderFormconfigurationResponses, DeleteApiCheckoutPubOrderFormByOrderFormIdAttachmentsSubscriptionDataData, DeleteApiCheckoutPubOrderFormByOrderFormIdAttachmentsSubscriptionDataResponses, DeleteApiCheckoutPubOrderFormByOrderFormIdCustomFieldsItemByItemIdData, DeleteApiCheckoutPubOrderFormByOrderFormIdCustomFieldsItemByItemIdResponses, DeleteApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexAttachmentsByAttachmentNameData, DeleteApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexAttachmentsByAttachmentNameResponses, DeleteApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexPriceData, DeleteApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexPriceResponses, GetAddressByPostalCodeData, GetAddressByPostalCodeResponses, GetCartInformationByIdData, GetCartInformationByIdResponses, GetCartInstallmentsData, GetCartInstallmentsResponses, GetClientProfileByEmailData, GetClientProfileByEmailResponses, GetorderFormconfigurationData, GetorderFormconfigurationResponses, GetSellersByRegionData, GetSellersByRegionResponses, GetWindowToChangeSellerData, GetWindowToChangeSellerResponses, IgnoreProfileDataData, IgnoreProfileDataResponses, ItemsData, ItemsHandleData, ItemsHandleResponses, ItemsResponses, ItemsUpdateData, ItemsUpdateResponses, ListPickupPpointsByLocationData, ListPickupPpointsByLocationResponses, PlaceOrderData, PlaceOrderFromExistingOrderFormData, PlaceOrderFromExistingOrderFormResponses, PlaceOrderResponses, PostApiCheckoutPubOrderFormByOrderFormIdAttachmentsInvoiceDataData, PostApiCheckoutPubOrderFormByOrderFormIdAttachmentsInvoiceDataResponses, PostApiCheckoutPubOrderFormByOrderFormIdAttachmentsSubscriptionDataData, PostApiCheckoutPubOrderFormByOrderFormIdAttachmentsSubscriptionDataResponses, PostApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexAttachmentsByAttachmentNameData, PostApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexAttachmentsByAttachmentNameResponses, PriceChangeData, PriceChangeResponses, ProcessOrderData, ProcessOrderErrors, ProcessOrderResponses, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsAddressByAddressIdData, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsAddressByAddressIdResponses, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsData, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsItemByItemIdData, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsItemByItemIdResponses, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsOrderData, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsOrderResponses, PutApiCheckoutPubOrderFormByOrderFormIdCustomFieldsResponses, RemoveAllItemsData, RemoveAllItemsResponses, RemoveallpersonaldataData, RemoveallpersonaldataResponses, RemovesinglecustomfieldvalueData, RemovesinglecustomfieldvalueResponses, SetMultipleCustomFieldValuesData, SetMultipleCustomFieldValuesResponses, SetSingleCustomFieldValueData, SetSingleCustomFieldValueResponses, UpdateorderFormconfigurationData, UpdateorderFormconfigurationResponses, UpdateWindowToChangeSellerData, UpdateWindowToChangeSellerResponses } from './types.gen'; export type Options = Options2 & { /** @@ -221,6 +221,41 @@ export const itemsHandle = (options: Optio */ export const items = (options: Options) => (options.client ?? client).post({ url: '/api/checkout/pub/orderForm/{orderFormId}/items', ...options }); +/** + * Delete manual price of an SKU in a cart + * + * This request deletes the manual price previously set for an SKU in a cart, reverting the item to its original price. + * + * The [orderForm](https://developers.vtex.com/docs/guides/orderform-fields) is the data structure which represents a shopping cart and contains all information pertaining to it. Hence, the `orderFormId` is the identification code of a given cart. + * + * You need to inform which cart you are referring to, by sending its `orderFormId`, and which item should have its manual price deleted, by sending its `itemIndex`. + * + * Remember that, to use this endpoint, the feature of *manual price* must be active. To check if it's active, use the [Get orderForm configuration](https://developers.vtex.com/docs/api-reference/checkout-api#get-/api/checkout/pvt/configuration/orderForm) endpoint. To make it active, use the [Update orderForm configuration](https://developers.vtex.com/docs/api-reference/checkout-api#post-/api/checkout/pvt/configuration/orderForm) endpoint, making the `allowManualPrice` field `true`. + * + * > Whenever you use this request to delete the manual price of an item, all items in that cart with the same SKU are affected by this change. This applies even to items that share the SKU but have been separated into different objects in the `items` array due to customizations or attachments, for example. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Checkout | CheckoutResources | **Read Shopping Cart** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const deleteApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexPrice = (options: Options) => (options.client ?? client).delete({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/checkout/pub/orderForm/{orderFormId}/items/{itemIndex}/price', + ...options +}); + /** * Change price of an SKU in a cart * @@ -328,7 +363,7 @@ export const getClientProfileByEmail = (op * The [orderForm](https://developers.vtex.com/docs/guides/orderform-fields) is the data structure which represents a shopping cart and contains all information pertaining to it. Hence, the `orderFormId` is the identification code of a given cart. * * - * > This request has a time out of 12 seconds. + * This request has a timeout of 12 seconds. * * >⚠️ The authentication of this endpoint can change depending on the customer context. If you are modifying information from a customer with a complete profile on the store, the response will return the customer's data masked. You can only access the customer data with an authenticated request. * @@ -351,14 +386,23 @@ export const addClientProfile = (options: * * Use this request to include shipping information and/or selected delivery option to a given shopping cart. * - * To add shipping addresses send the `selectedAddresses` array. For delivery option use the `logisticsInfo` array. + * To add shipping addresses, send the `selectedAddresses` array. To select a delivery option, use the `logisticsInfo` array. * - * The [orderForm](https://developers.vtex.com/docs/guides/orderform-fields) is the data structure which represents a shopping cart and contains all information pertaining to it. Hence, the `orderFormId` is the identification code of a given cart. + * The `orderFormId` identifies the shopping cart. For more information, see [orderForm](https://developers.vtex.com/docs/guides/orderform-fields). * + * This request has a timeout of 12 seconds. * - * > This request has a time out of 12 seconds. + * >⚠️ If the request modifies a customer with a complete profile, the response will return masked data. To access unmasked data, use an authenticated request. * - * >⚠️ The authentication of this endpoint can change depending on the customer context. If you are modifying information from a customer with a complete profile on the store, the response will return the customer's data masked. You can only access the customer data with an authenticated request. + * ## Delivery option selection + * + * If no `selectedSla` is sent in the request body, the API will automatically select the best delivery option among the ones available in the `slas` array, excluding pickup options and scheduled delivery options. If no such option is available, none will be selected. + * + * The best delivery option selected is the one that can fulfill the biggest item quantity for the lowest price. This selection does not consider delivery time. + * + * This process happens after the White Label Sellers selection in the Checkout pipeline. White label sellers selection is a separate process and is the responsibility of the Order Allocation module. For more information, see the [White label sellers selection](https://help.vtex.com/en/docs/tutorials/white-label-sellers-selection) article. + * + * For a pickup option or a scheduled delivery option to be selected, it must be explicitly sent in the request body in the `selectedSla` field. * * ## Permissions * @@ -382,7 +426,7 @@ export const addShippingAddress = (options * The [orderForm](https://developers.vtex.com/docs/guides/orderform-fields) is the data structure which represents a shopping cart and contains all information pertaining to it. Hence, the `orderFormId` is the identification code of a given cart. * * - * > This request has a time out of 12 seconds. + * This request has a timeout of 12 seconds. * * ## Permissions * @@ -406,7 +450,7 @@ export const addClientPreferences = (optio * The [orderForm](https://developers.vtex.com/docs/guides/orderform-fields) is the data structure which represents a shopping cart and contains all information pertaining to it. Hence, the `orderFormId` is the identification code of a given cart. * * - * > This request has a time out of 12 seconds. + * This request has a timeout of 12 seconds. * * ## Permissions * @@ -430,7 +474,7 @@ export const addMarketingData = (options: * The [orderForm](https://developers.vtex.com/docs/guides/orderform-fields) is the data structure which represents a shopping cart and contains all information pertaining to it. Hence, the `orderFormId` is the identification code of a given cart. * * - * > This request has a time out of 12 seconds. + * This request has a timeout of 12 seconds. * * ## Permissions * @@ -446,6 +490,108 @@ export const addMarketingData = (options: */ export const addPaymentData = (options: Options) => (options.client ?? client).post({ url: '/api/checkout/pub/orderForm/{orderFormId}/attachments/paymentData', ...options }); +/** + * Remove item attachment + * + * Use this request to remove an attachment from a specific item in a shopping cart. Attachments allow you to include extra information to a cart item, such as subscription or gift details, according to the attachment schemas available for that item, which can be checked in the `attachmentOfferings` field of the [orderForm](https://developers.vtex.com/docs/guides/orderform-fields). + * + * The [orderForm](https://developers.vtex.com/docs/guides/orderform-fields) is the data structure which represents a shopping cart and contains all information pertaining to it. This means the `orderFormId` is the identification code of a given cart. + * + * + * You need to inform which cart you are referring to, by sending its `orderFormId`, which item will have the attachment removed, by sending its `itemIndex`, and the name of the attachment, by sending its `attachmentName`. + * + * + * > This request has a timeout of 12 seconds. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Checkout | CheckoutResources | **Read Shopping Cart** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const deleteApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexAttachmentsByAttachmentName = (options: Options) => (options.client ?? client).delete({ url: '/api/checkout/pub/orderForm/{orderFormId}/items/{itemIndex}/attachments/{attachmentName}', ...options }); + +/** + * Add item attachment + * + * Use this request to add an attachment to a specific item in a shopping cart. Attachments allow you to include extra information to a cart item, such as subscription or gift details, according to the attachment schemas available for that item, which can be checked in the `attachmentOfferings` field of the [orderForm](https://developers.vtex.com/docs/guides/orderform-fields). + * + * The [orderForm](https://developers.vtex.com/docs/guides/orderform-fields) is the data structure which represents a shopping cart and contains all information pertaining to it. This means the `orderFormId` is the identification code of a given cart. + * + * + * You need to inform which cart you are referring to, by sending its `orderFormId`, which item will receive the attachment, by sending its `itemIndex`, and the name of the attachment, by sending its `attachmentName`. + * + * + * > This request has a timeout of 12 seconds. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Checkout | CheckoutResources | **Read Shopping Cart** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const postApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexAttachmentsByAttachmentName = (options: Options) => (options.client ?? client).post({ url: '/api/checkout/pub/orderForm/{orderFormId}/items/{itemIndex}/attachments/{attachmentName}', ...options }); + +/** + * Remove item subscription attachment + * + * Use this request to remove the subscription information attached to the items in a shopping cart. To remove all subscriptions from the cart, send an empty `subscriptions` array in the request body. + * + * The [orderForm](https://developers.vtex.com/docs/guides/orderform-fields) is the data structure which represents a shopping cart and contains all information pertaining to it. This means the `orderFormId` is the identification code of a given cart. + * + * + * > This request has a timeout of 12 seconds. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Checkout | CheckoutResources | **Read Shopping Cart** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const deleteApiCheckoutPubOrderFormByOrderFormIdAttachmentsSubscriptionData = (options: Options) => (options.client ?? client).delete({ url: '/api/checkout/pub/orderForm/{orderFormId}/attachments/subscriptionData', ...options }); + +/** + * Add item subscription attachment + * + * Use this request to attach subscription information to one or more items in a shopping cart, defining the recurrence plan (frequency, validity, and type) under which the items will be purchased. The available subscription schemas for each item can be checked in the `attachmentOfferings` field of the [orderForm](https://developers.vtex.com/docs/guides/orderform-fields). + * + * The [orderForm](https://developers.vtex.com/docs/guides/orderform-fields) is the data structure which represents a shopping cart and contains all information pertaining to it. This means the `orderFormId` is the identification code of a given cart. + * + * + * > This request has a timeout of 12 seconds. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Checkout | CheckoutResources | **Read Shopping Cart** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const postApiCheckoutPubOrderFormByOrderFormIdAttachmentsSubscriptionData = (options: Options) => (options.client ?? client).post({ url: '/api/checkout/pub/orderForm/{orderFormId}/attachments/subscriptionData', ...options }); + /** * Add merchant context data * @@ -454,7 +600,7 @@ export const addPaymentData = (options: Op * The [orderForm](https://developers.vtex.com/docs/guides/orderform-fields) is the data structure which represents a shopping cart and contains all information pertaining to it. Hence, the `orderFormId` is the identification code of a given cart. * * - * > This request has a time out of 12 seconds. + * This request has a timeout of 12 seconds. * * ## Permissions * @@ -478,7 +624,7 @@ export const addMerchantContextData = (opt * The [`orderForm`](https://developers.vtex.com/docs/guides/orderform-fields) is the data structure which represents a shopping cart and contains all information pertaining to it. Hence, the `orderFormId` is the identification code of a given cart. * * - * > This request has a time out of 12 seconds. + * This request has a timeout of 12 seconds. * * ## Permissions * @@ -752,7 +898,40 @@ export const getorderFormconfiguration = ( * * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. */ -export const updateorderFormconfiguration = (options: Options) => (options.client ?? client).post({ +export const updateorderFormconfiguration = (options: Options) => (options.client ?? client).patch({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/checkout/pvt/configuration/orderForm', + ...options +}); + +/** + * Create order form configuration + * + * Creates the settings that will apply to every `orderForm` in the account. + * + * + * For example, if you create an app using this request, every `orderForm` of this account will have the custom fields created through it. + * + * + * >ℹ️ This request overwrites the entire configuration. To update only specific properties without overwriting the others, use the request [Update order form configuration](https://developers.vtex.com/docs/api-reference/checkout-api#patch-/api/checkout/pvt/configuration/orderForm) instead. Always retrieve the current configuration beforehand using the request [Get orderForm configuration](https://developers.vtex.com/docs/api-reference/checkout-api#get-/api/checkout/pvt/configuration/orderForm). + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise, they will receive a `403` status code. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Checkout | CheckoutResources | **Save OrderForm Configuration** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const createorderFormconfiguration = (options: Options) => (options.client ?? client).post({ security: [ { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, diff --git a/vtex/server/generated/checkout/types.gen.ts b/vtex/server/generated/checkout/types.gen.ts index 58353637..0fce84fc 100644 --- a/vtex/server/generated/checkout/types.gen.ts +++ b/vtex/server/generated/checkout/types.gen.ts @@ -39,7 +39,7 @@ export type OrderForm = { /** * Unique ID associated with the customer profile. */ - userProfileId?: string; + userProfileId?: string | null; /** * Profile provider. */ @@ -65,7 +65,15 @@ export type OrderForm = { */ addressId?: string | null; /** - * Indicates whether address is disposable. + * Indicates whether the address is disposable. Addresses marked as `isDisposable = true` are not saved to the shopper's profile when the order is completed, while addresses with `isDisposable = false` definitely belong to the shopper. + * + * Behavior by address type: + * - `giftRegistry`, `pickup`, `search`, and `inStore`: always disposable, as they do not belong to the shopper navigating the cart. + * - `residential`: may be disposable. Addresses from a complete shopper profile, or entered by an authenticated shopper with a complete profile, are not disposable. All other residential addresses are disposable, including those from first-time purchases, since no complete profile exists yet. + * - `invoice`: does not have the `isDisposable` flag, since invoice addresses are of type `Address` rather than `ShippingAddress`. In practice, only authenticated shoppers can add invoice attachments to the cart, so they are never treated as disposable. + * - `commercial`: corresponds to company addresses used in B2B contexts and follows the same logic as residential addresses. + * + * When a residential address is marked as disposable and the profile is complete, authentication is required to complete the order. Additionally, when a disposable residential address is used to complete a purchase, saved cards cannot be used. */ isDisposable?: boolean; /** @@ -144,7 +152,7 @@ export type OrderForm = { /** * Ref ID. */ - refId?: string; + refId?: string | null; /** * European Article Number. */ @@ -299,7 +307,18 @@ export type OrderForm = { /** * Array containing information on attachments. */ - attachments?: Array; + attachments?: Array<{ + /** + * Attachment name. + */ + name?: string; + /** + * Object containing the attachment content as key-value pairs. + */ + content?: { + [key: string]: unknown; + }; + }>; /** * Array of price tags, each of which, modifies the price in some way, like discounts or taxes that apply to the item in the context of the order. */ @@ -397,13 +416,21 @@ export type OrderForm = { /** * Name of the person who is going to receive the order. */ - receiverName?: string; + receiverName?: string | null; /** * Address ID. */ addressId?: string | null; /** - * Indicates whether address is disposable. + * Indicates whether the address is disposable. Addresses marked as `isDisposable = true` are not saved to the shopper's profile when the order is completed, while addresses with `isDisposable = false` definitely belong to the shopper. + * + * Behavior by address type: + * - `giftRegistry`, `pickup`, `search`, and `inStore`: always disposable, as they do not belong to the shopper navigating the cart. + * - `residential`: may be disposable. Addresses from a complete shopper profile, or entered by an authenticated shopper with a complete profile, are not disposable. All other residential addresses are disposable, including those from first-time purchases, since no complete profile exists yet. + * - `invoice`: does not have the `isDisposable` flag, since invoice addresses are of type `Address` rather than `ShippingAddress`. In practice, only authenticated shoppers can add invoice attachments to the cart, so they are never treated as disposable. + * - `commercial`: corresponds to company addresses used in B2B contexts and follows the same logic as residential addresses. + * + * When a residential address is marked as disposable and the profile is complete, authentication is required to complete the order. Additionally, when a disposable residential address is used to complete a purchase, saved cards cannot be used. */ isDisposable?: boolean; /** @@ -456,7 +483,7 @@ export type OrderForm = { */ itemIndex?: number; /** - * SLA selected by the customer. If the store uses the [Delivery Option](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, this field returns the delivery option ID selected for this SLA, as the example `1223d5b4-52a4-442f-ab23-01345b60be48`. + * SLA selected by the customer. If the store uses the [Delivery Options](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, this field returns the delivery option ID selected for this SLA, as the example `1223d5b4-52a4-442f-ab23-01345b60be48`. */ selectedSla?: string | null; /** @@ -472,7 +499,7 @@ export type OrderForm = { */ slas?: Array<{ /** - * SLA ID. If the store uses the [Delivery Option](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, this field returns the delivery option ID selected for this SLA, as the example `1223d5b4-52a4-442f-ab23-01345b60be48`. + * SLA ID. If the store uses the [Delivery Options](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, this field returns the delivery option ID selected for this SLA, as the example `1223d5b4-52a4-442f-ab23-01345b60be48`. */ id?: string; /** @@ -480,7 +507,7 @@ export type OrderForm = { */ deliveryChannel?: string; /** - * SLA name. If the store uses the [Delivery Option](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, the value of this field will show the specific delivery option name selected for this SLA, as the example `Delivery | BRA | Up to 30 hours`. + * SLA name. If the store uses the [Delivery Options](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, the value of this field will show the specific delivery option name selected for this SLA, as the example `Delivery | BRA | Up to 30 hours`. */ name?: string; /** @@ -528,7 +555,7 @@ export type OrderForm = { } | null; }> | null; /** - * Shipping estimate. For instance, "three business days" will be represented as `3bd`. + * Shipping estimate. For instance, "three business days" will be represented as `3bd`. The unit can be `bd` for business days, `d` for days, `h` for hours, or `m` for minutes. */ shippingEstimate?: string; /** @@ -671,13 +698,21 @@ export type OrderForm = { /** * Name of the person who is going to receive the order. */ - receiverName?: string; + receiverName?: string | null; /** * Address ID. */ addressId?: string | null; /** - * Indicates whether address is disposable. + * Indicates whether the address is disposable. Addresses marked as `isDisposable = true` are not saved to the shopper's profile when the order is completed, while addresses with `isDisposable = false` definitely belong to the shopper. + * + * Behavior by address type: + * - `giftRegistry`, `pickup`, `search`, and `inStore`: always disposable, as they do not belong to the shopper navigating the cart. + * - `residential`: may be disposable. Addresses from a complete shopper profile, or entered by an authenticated shopper with a complete profile, are not disposable. All other residential addresses are disposable, including those from first-time purchases, since no complete profile exists yet. + * - `invoice`: does not have the `isDisposable` flag, since invoice addresses are of type `Address` rather than `ShippingAddress`. In practice, only authenticated shoppers can add invoice attachments to the cart, so they are never treated as disposable. + * - `commercial`: corresponds to company addresses used in B2B contexts and follows the same logic as residential addresses. + * + * When a residential address is marked as disposable and the profile is complete, authentication is required to complete the order. Additionally, when a disposable residential address is used to complete a purchase, saved cards cannot be used. */ isDisposable?: boolean; /** @@ -732,13 +767,21 @@ export type OrderForm = { /** * Name of the person who is going to receive the order. */ - receiverName?: string; + receiverName?: string | null; /** * Address ID. */ addressId?: string | null; /** - * Indicates whether address is disposable. + * Indicates whether the address is disposable. Addresses marked as `isDisposable = true` are not saved to the shopper's profile when the order is completed, while addresses with `isDisposable = false` are saved. + * + * Behavior by address type: + * - `giftRegistry`, `pickup`, `search`, and `inStore`: always disposable, as they do not belong to the shopper navigating the cart. + * - `residential`: may be disposable. Addresses from a complete shopper profile, or entered by an authenticated shopper with a complete profile, are not disposable. All other residential addresses are disposable, including those from first-time purchases, since no complete profile exists yet. + * - `invoice`: does not have the `isDisposable` flag, since invoice addresses are of type `Address` rather than `ShippingAddress`. In practice, only authenticated shoppers can add invoice attachments to the cart, so they are never treated as disposable. + * - `commercial`: corresponds to company addresses used in B2B contexts and follows the same logic as residential addresses. + * + * When a residential address is marked as disposable and the profile is complete, authentication is required to complete the order. Additionally, when a disposable residential address is used to complete a purchase, saved cards cannot be used. */ isDisposable?: boolean; /** @@ -985,6 +1028,10 @@ export type OrderForm = { * Seller logo. */ logo?: string | null; + /** + * Minimum order value configured at the seller, in cents. + */ + minimumOrderValue?: number | null; }>; /** * Object containing preferences from the client who placed the order. @@ -1148,7 +1195,7 @@ export type OrderForm = { /** * Ref ID. */ - refId?: string; + refId?: string | null; /** * European Article Number. */ @@ -1200,7 +1247,7 @@ export type OrderForm = { * Indicates whether the ordering is ascending. */ ascending?: boolean; - }; + } | null; }; /** @@ -1865,7 +1912,7 @@ export type CartSimulationResponses = { */ addressId?: string | null; /** - * Selected SLA. For example, `"normal"` or `"express"`. If the store uses the [Delivery Option](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, this field returns the delivery option ID selected for this SLA, as the example `1223d5b4-52a4-442f-ab23-01345b60be48`. + * Selected SLA. For example, `normal` or `express`. If the store uses the [Delivery Options](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, this field returns the delivery option ID selected for this SLA, as the example `1223d5b4-52a4-442f-ab23-01345b60be48`. */ selectedSla?: string | null; /** @@ -1885,7 +1932,7 @@ export type CartSimulationResponses = { */ slas?: Array<{ /** - * SLA ID. If the store uses the [Delivery Option](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, this field returns the delivery option ID selected for this SLA, as the example `1223d5b4-52a4-442f-ab23-01345b60be48`. + * SLA ID. If the store uses the [Delivery Options](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, this field returns the delivery option ID selected for this SLA, as the example `1223d5b4-52a4-442f-ab23-01345b60be48`. */ id?: string; /** @@ -1893,7 +1940,7 @@ export type CartSimulationResponses = { */ deliveryChannel?: string; /** - * SLA name. If the store uses the [Delivery Option](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, the value of this field will show the specific delivery option name selected for this SLA, as the example `Delivery | BRA | Up to 30 hours`. + * SLA name. If the store uses the [Delivery Options](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, the value of this field will show the specific delivery option name selected for this SLA, as the example `Delivery | BRA | Up to 30 hours`. */ name?: string; /** @@ -1941,7 +1988,7 @@ export type CartSimulationResponses = { } | null; }> | null; /** - * Shipping estimate. For instance, "three business days" will be represented as `3bd`. + * Shipping estimate. For instance, "three business days" will be represented as `3bd`. The unit can be `bd` for business days, `d` for days, `h` for hours, or `m` for minutes. */ shippingEstimate?: string; /** @@ -2100,7 +2147,7 @@ export type CartSimulationResponses = { */ slas?: Array<{ /** - * SLA ID. If the store uses the [Delivery Option](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, this field returns the delivery option ID selected for this SLA, as the example `1223d5b4-52a4-442f-ab23-01345b60be48`. + * SLA ID. If the store uses the [Delivery Options](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, this field returns the delivery option ID selected for this SLA, as the example `1223d5b4-52a4-442f-ab23-01345b60be48`. */ id?: string; /** @@ -2108,7 +2155,7 @@ export type CartSimulationResponses = { */ deliveryChannel?: string; /** - * SLA name. If the store uses the [Delivery Option](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, the value of this field will show the specific delivery option name selected for this SLA, as the example `Delivery | BRA | Up to 30 hours`. + * SLA name. If the store uses the [Delivery Options](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, the value of this field will show the specific delivery option name selected for this SLA, as the example `Delivery | BRA | Up to 30 hours`. */ name?: string; /** @@ -2156,7 +2203,7 @@ export type CartSimulationResponses = { } | null; }> | null; /** - * Shipping estimate. For instance, "three business days" will be represented as `3bd`. + * Shipping estimate. For instance, "three business days" will be represented as `3bd`. The unit can be `bd` for business days, `d` for days, `h` for hours, or `m` for minutes. */ shippingEstimate?: string; /** @@ -2710,6 +2757,48 @@ export type ItemsResponses = { export type ItemsResponse = ItemsResponses[keyof ItemsResponses]; +export type DeleteApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexPriceData = { + body?: never; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path: { + /** + * ID of the orderForm corresponding to the cart whose item will have the manual price deleted. + */ + orderFormId: string; + /** + * The index of the item in the cart. Each cart item is identified by an index, starting in 0. + */ + itemIndex: string; + }; + query?: { + /** + * Shows the product's estimated shipping date in the `shippingEstimate` field from the `orderForm`. + */ + individualShippingEstimates?: boolean; + }; + url: '/api/checkout/pub/orderForm/{orderFormId}/items/{itemIndex}/price'; +}; + +export type DeleteApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexPriceResponses = { + /** + * This object is empty. + */ + 200: { + [key: string]: unknown; + }; +}; + +export type DeleteApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexPriceResponse = DeleteApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexPriceResponses[keyof DeleteApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexPriceResponses]; + export type PriceChangeData = { body: PriceChangeRequest; headers: { @@ -2855,7 +2944,15 @@ export type GetClientProfileByEmailResponses = { */ addressId?: string | null; /** - * Indicates whether address is disposable. + * Indicates whether the address is disposable. Addresses marked as `isDisposable = true` are not saved to the shopper's profile when the order is completed, while addresses with `isDisposable = false` definitely belong to the shopper. + * + * Behavior by address type: + * - `giftRegistry`, `pickup`, `search`, and `inStore`: always disposable, as they do not belong to the shopper navigating the cart. + * - `residential`: may be disposable. Addresses from a complete shopper profile, or entered by an authenticated shopper with a complete profile, are not disposable. All other residential addresses are disposable, including those from first-time purchases, since no complete profile exists yet. + * - `invoice`: does not have the `isDisposable` flag, since invoice addresses are of type `Address` rather than `ShippingAddress`. In practice, only authenticated shoppers can add invoice attachments to the cart, so they are never treated as disposable. + * - `commercial`: corresponds to company addresses used in B2B contexts and follows the same logic as residential addresses. + * + * When a residential address is marked as disposable and the profile is complete, authentication is required to complete the order. Additionally, when a disposable residential address is used to complete a purchase, saved cards cannot be used. */ isDisposable?: boolean; /** @@ -3133,7 +3230,7 @@ export type AddShippingAddressData = { */ selectedDeliveryChannel?: string | null; /** - * Selected SLA. For example, `"normal"` or `"express"`. If the store uses the [Delivery Option](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, this field returns the delivery option ID selected for this SLA, as the example `1223d5b4-52a4-442f-ab23-01345b60be48`. + * Selected SLA. For example, `normal` or `express`. If the store uses the [Delivery Options](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, this field returns the delivery option ID selected for this SLA, for example, `1223d5b4-52a4-442f-ab23-01345b60be48`. If this field is `null` or omitted, the API automatically selects the best delivery option available, excluding pickup and scheduled delivery options. To select a pickup option or a scheduled delivery option, it must be explicitly sent in this field. For more information, see the [Add shipping address and select delivery option](https://developers.vtex.com/docs/guides/checkout-api#tag/Cart-attachments/operation/AddShippingAddress) endpoint description. */ selectedSla?: string | null; }>; @@ -3367,6 +3464,225 @@ export type AddPaymentDataResponses = { export type AddPaymentDataResponse = AddPaymentDataResponses[keyof AddPaymentDataResponses]; +export type DeleteApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexAttachmentsByAttachmentNameData = { + body?: never; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path: { + /** + * ID of the orderForm corresponding to the cart whose item will have the attachment removed. + */ + orderFormId: string; + /** + * The index of the item in the cart that will have the attachment removed. Each cart item is identified by an index, starting in 0. + */ + itemIndex: string; + /** + * Name of the attachment that will be removed from the item. It must match one of the attachment schemas available for the item, listed in the `attachmentOfferings` field of the orderForm. + */ + attachmentName: string; + }; + query?: { + /** + * Shows the product's estimated shipping date in the `shippingEstimate` field from the `orderForm`. + */ + individualShippingEstimates?: boolean; + }; + url: '/api/checkout/pub/orderForm/{orderFormId}/items/{itemIndex}/attachments/{attachmentName}'; +}; + +export type DeleteApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexAttachmentsByAttachmentNameResponses = { + /** + * OK + */ + 200: OrderForm; +}; + +export type DeleteApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexAttachmentsByAttachmentNameResponse = DeleteApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexAttachmentsByAttachmentNameResponses[keyof DeleteApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexAttachmentsByAttachmentNameResponses]; + +export type PostApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexAttachmentsByAttachmentNameData = { + body: { + /** + * Object containing the attachment's key-value pairs, where each key is a field defined by the attachment schema and each value is the content to be set for that field. + */ + content: { + [key: string]: unknown; + }; + }; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path: { + /** + * ID of the orderForm corresponding to the cart whose item will receive the attachment. + */ + orderFormId: string; + /** + * The index of the item in the cart that will receive the attachment. Each cart item is identified by an index, starting in 0. + */ + itemIndex: string; + /** + * Name of the attachment that will be added to the item. It must match one of the attachment schemas available for the item, listed in the `attachmentOfferings` field of the orderForm. + */ + attachmentName: string; + }; + query?: { + /** + * Shows the product's estimated shipping date in the `shippingEstimate` field from the `orderForm`. + */ + individualShippingEstimates?: boolean; + }; + url: '/api/checkout/pub/orderForm/{orderFormId}/items/{itemIndex}/attachments/{attachmentName}'; +}; + +export type PostApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexAttachmentsByAttachmentNameResponses = { + /** + * OK + */ + 200: OrderForm; +}; + +export type PostApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexAttachmentsByAttachmentNameResponse = PostApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexAttachmentsByAttachmentNameResponses[keyof PostApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexAttachmentsByAttachmentNameResponses]; + +export type DeleteApiCheckoutPubOrderFormByOrderFormIdAttachmentsSubscriptionDataData = { + body: { + /** + * List of the item subscriptions in the cart. To remove all subscription information from the cart, send an empty array. + */ + subscriptions: Array<{ + [key: string]: unknown; + }>; + }; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path: { + /** + * ID of the orderForm corresponding to the cart that will have the subscription information removed. + */ + orderFormId: string; + }; + query?: { + /** + * Shows the product's estimated shipping date in the `shippingEstimate` field from the `orderForm`. + */ + individualShippingEstimates?: boolean; + }; + url: '/api/checkout/pub/orderForm/{orderFormId}/attachments/subscriptionData'; +}; + +export type DeleteApiCheckoutPubOrderFormByOrderFormIdAttachmentsSubscriptionDataResponses = { + /** + * OK + */ + 200: OrderForm; +}; + +export type DeleteApiCheckoutPubOrderFormByOrderFormIdAttachmentsSubscriptionDataResponse = DeleteApiCheckoutPubOrderFormByOrderFormIdAttachmentsSubscriptionDataResponses[keyof DeleteApiCheckoutPubOrderFormByOrderFormIdAttachmentsSubscriptionDataResponses]; + +export type PostApiCheckoutPubOrderFormByOrderFormIdAttachmentsSubscriptionDataData = { + body: { + /** + * List of the item subscriptions to be attached to the cart. + */ + subscriptions: Array<{ + /** + * Index that identifies the cart item the subscription refers to. Each cart item is identified by an index, starting in 0. + */ + itemIndex: number; + /** + * Object containing the subscription plan information. + */ + plan: { + /** + * Object containing the frequency in which the subscription order will be placed. + */ + frequency: { + /** + * Numerical interval between each subscription order, according to the chosen `periodicity`. + */ + interval: number; + /** + * Time unit for the subscription frequency. Possible values are `DAY`, `WEEK`, `MONTH`, and `YEAR`. + */ + periodicity: string; + }; + /** + * Object containing the period in which the subscription is valid. + */ + validity?: { + /** + * Date when the subscription becomes valid, in the `YYYY-MM-DD` format. + */ + begin?: string; + /** + * Date when the subscription expires, in the `YYYY-MM-DD` format. + */ + end?: string; + }; + /** + * Type of the subscription plan. + */ + type: string; + }; + }>; + }; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path: { + /** + * ID of the orderForm corresponding to the cart that will receive the subscription information. + */ + orderFormId: string; + }; + query?: { + /** + * Shows the product's estimated shipping date in the `shippingEstimate` field from the `orderForm`. + */ + individualShippingEstimates?: boolean; + }; + url: '/api/checkout/pub/orderForm/{orderFormId}/attachments/subscriptionData'; +}; + +export type PostApiCheckoutPubOrderFormByOrderFormIdAttachmentsSubscriptionDataResponses = { + /** + * OK + */ + 200: OrderForm; +}; + +export type PostApiCheckoutPubOrderFormByOrderFormIdAttachmentsSubscriptionDataResponse = PostApiCheckoutPubOrderFormByOrderFormIdAttachmentsSubscriptionDataResponses[keyof PostApiCheckoutPubOrderFormByOrderFormIdAttachmentsSubscriptionDataResponses]; + export type AddMerchantContextDataData = { body: { /** @@ -4060,6 +4376,37 @@ export type UpdateorderFormconfigurationResponses = { export type UpdateorderFormconfigurationResponse = UpdateorderFormconfigurationResponses[keyof UpdateorderFormconfigurationResponses]; +export type CreateorderFormconfigurationData = { + body: UpdateorderFormconfigurationRequest; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path?: never; + query?: { + /** + * Shows the product's estimated shipping date in the `shippingEstimate` field from the `orderForm`. + */ + individualShippingEstimates?: boolean; + }; + url: '/api/checkout/pvt/configuration/orderForm'; +}; + +export type CreateorderFormconfigurationResponses = { + /** + * No Content + */ + 204: void; +}; + +export type CreateorderFormconfigurationResponse = CreateorderFormconfigurationResponses[keyof CreateorderFormconfigurationResponses]; + export type GetWindowToChangeSellerData = { body?: never; headers: { @@ -4214,7 +4561,15 @@ export type ClearorderFormMessagesResponses = { */ addressId?: string | null; /** - * Indicates whether address is disposable. + * Indicates whether the address is disposable. Addresses marked as `isDisposable = true` are not saved to the shopper's profile when the order is completed, while addresses with `isDisposable = false` definitely belong to the shopper. + * + * Behavior by address type: + * - `giftRegistry`, `pickup`, `search`, and `inStore`: always disposable, as they do not belong to the shopper navigating the cart. + * - `residential`: may be disposable. Addresses from a complete shopper profile, or entered by an authenticated shopper with a complete profile, are not disposable. All other residential addresses are disposable, including those from first-time purchases, since no complete profile exists yet. + * - `invoice`: does not have the `isDisposable` flag, since invoice addresses are of type `Address` rather than `ShippingAddress`. In practice, only authenticated shoppers can add invoice attachments to the cart, so they are never treated as disposable. + * - `commercial`: corresponds to company addresses used in B2B contexts and follows the same logic as residential addresses. + * + * When a residential address is marked as disposable and the profile is complete, authentication is required to complete the order. Additionally, when a disposable residential address is used to complete a purchase, saved cards cannot be used. */ isDisposable?: boolean; /** @@ -4548,7 +4903,15 @@ export type ClearorderFormMessagesResponses = { */ addressId?: string | null; /** - * Indicates whether address is disposable. + * Indicates whether the address is disposable. Addresses marked as `isDisposable = true` are not saved to the shopper's profile when the order is completed, while addresses with `isDisposable = false` definitely belong to the shopper. + * + * Behavior by address type: + * - `giftRegistry`, `pickup`, `search`, and `inStore`: always disposable, as they do not belong to the shopper navigating the cart. + * - `residential`: may be disposable. Addresses from a complete shopper profile, or entered by an authenticated shopper with a complete profile, are not disposable. All other residential addresses are disposable, including those from first-time purchases, since no complete profile exists yet. + * - `invoice`: does not have the `isDisposable` flag, since invoice addresses are of type `Address` rather than `ShippingAddress`. In practice, only authenticated shoppers can add invoice attachments to the cart, so they are never treated as disposable. + * - `commercial`: corresponds to company addresses used in B2B contexts and follows the same logic as residential addresses. + * + * When a residential address is marked as disposable and the profile is complete, authentication is required to complete the order. Additionally, when a disposable residential address is used to complete a purchase, saved cards cannot be used. */ isDisposable?: boolean; /** @@ -4601,7 +4964,7 @@ export type ClearorderFormMessagesResponses = { */ itemIndex?: number; /** - * SLA selected by the customer. If the store uses the [Delivery Option](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, this field returns the delivery option ID selected for this SLA, as the example `1223d5b4-52a4-442f-ab23-01345b60be48`. + * Selected SLA. For example, `normal` or `express`. If the store uses the [Delivery Options](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, this field returns the delivery option ID selected for this SLA, for example, `1223d5b4-52a4-442f-ab23-01345b60be48`. If this field is `null` or omitted, the API automatically selects the best delivery option available, excluding pickup and scheduled delivery options. To select a pickup option or a scheduled delivery option, it must be explicitly sent in this field. For more information, see the [Add shipping address and select delivery option](https://developers.vtex.com/docs/guides/checkout-api#tag/Cart-attachments/operation/AddShippingAddress) endpoint description. */ selectedSla?: string | null; /** @@ -4617,7 +4980,7 @@ export type ClearorderFormMessagesResponses = { */ slas?: Array<{ /** - * SLA ID. If the store uses the [Delivery Option](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, this field returns the delivery option ID selected for this SLA, as the example `1223d5b4-52a4-442f-ab23-01345b60be48`. + * SLA ID. If the store uses the [Delivery Options](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, this field returns the delivery option ID selected for this SLA, as the example `1223d5b4-52a4-442f-ab23-01345b60be48`. */ id?: string; /** @@ -4625,7 +4988,7 @@ export type ClearorderFormMessagesResponses = { */ deliveryChannel?: string; /** - * SLA name. If the store uses the [Delivery Option](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, the value of this field will show the specific delivery option name selected for this SLA, as the example `Delivery | BRA | Up to 30 hours`. + * SLA name. If the store uses the [Delivery Options](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, the value of this field will show the specific delivery option name selected for this SLA, as the example `Delivery | BRA | Up to 30 hours`. */ name?: string; /** @@ -4673,7 +5036,7 @@ export type ClearorderFormMessagesResponses = { } | null; }> | null; /** - * Shipping estimate. For instance, Three business days will be represented `3bd`. + * Shipping estimate. For instance, Three business days will be represented `3bd`. The unit can be `bd` for business days, `d` for days, `h` for hours, or `m` for minutes. */ shippingEstimate?: string; /** @@ -4822,7 +5185,15 @@ export type ClearorderFormMessagesResponses = { */ addressId?: string | null; /** - * Indicates whether address is disposable. + * Indicates whether the address is disposable. Addresses marked as `isDisposable = true` are not saved to the shopper's profile when the order is completed, while addresses with `isDisposable = false` definitely belong to the shopper. + * + * Behavior by address type: + * - `giftRegistry`, `pickup`, `search`, and `inStore`: always disposable, as they do not belong to the shopper navigating the cart. + * - `residential`: may be disposable. Addresses from a complete shopper profile, or entered by an authenticated shopper with a complete profile, are not disposable. All other residential addresses are disposable, including those from first-time purchases, since no complete profile exists yet. + * - `invoice`: does not have the `isDisposable` flag, since invoice addresses are of type `Address` rather than `ShippingAddress`. In practice, only authenticated shoppers can add invoice attachments to the cart, so they are never treated as disposable. + * - `commercial`: corresponds to company addresses used in B2B contexts and follows the same logic as residential addresses. + * + * When a residential address is marked as disposable and the profile is complete, authentication is required to complete the order. Additionally, when a disposable residential address is used to complete a purchase, saved cards cannot be used. */ isDisposable?: boolean; /** @@ -4883,7 +5254,15 @@ export type ClearorderFormMessagesResponses = { */ addressId?: string | null; /** - * Indicates whether address is disposable. + * Indicates whether the address is disposable. Addresses marked as `isDisposable = true` are not saved to the shopper's profile when the order is completed, while addresses with `isDisposable = false` definitely belong to the shopper. + * + * Behavior by address type: + * - `giftRegistry`, `pickup`, `search`, and `inStore`: always disposable, as they do not belong to the shopper navigating the cart. + * - `residential`: may be disposable. Addresses from a complete shopper profile, or entered by an authenticated shopper with a complete profile, are not disposable. All other residential addresses are disposable, including those from first-time purchases, since no complete profile exists yet. + * - `invoice`: does not have the `isDisposable` flag, since invoice addresses are of type `Address` rather than `ShippingAddress`. In practice, only authenticated shoppers can add invoice attachments to the cart, so they are never treated as disposable. + * - `commercial`: corresponds to company addresses used in B2B contexts and follows the same logic as residential addresses. + * + * When a residential address is marked as disposable and the profile is complete, authentication is required to complete the order. Additionally, when a disposable residential address is used to complete a purchase, saved cards cannot be used. */ isDisposable?: boolean; /** @@ -5130,6 +5509,10 @@ export type ClearorderFormMessagesResponses = { * Seller logo. */ logo?: string | null; + /** + * Minimum order value configured at the seller, in cents. + */ + minimumOrderValue?: number | null; }>; /** * Object containing preferences from the client who placed the order. @@ -5476,7 +5859,15 @@ export type AddCouponsResponses = { */ addressId?: string | null; /** - * Indicates whether address is disposable. + * Indicates whether the address is disposable. Addresses marked as `isDisposable = true` are not saved to the shopper's profile when the order is completed, while addresses with `isDisposable = false` definitely belong to the shopper. + * + * Behavior by address type: + * - `giftRegistry`, `pickup`, `search`, and `inStore`: always disposable, as they do not belong to the shopper navigating the cart. + * - `residential`: may be disposable. Addresses from a complete shopper profile, or entered by an authenticated shopper with a complete profile, are not disposable. All other residential addresses are disposable, including those from first-time purchases, since no complete profile exists yet. + * - `invoice`: does not have the `isDisposable` flag, since invoice addresses are of type `Address` rather than `ShippingAddress`. In practice, only authenticated shoppers can add invoice attachments to the cart, so they are never treated as disposable. + * - `commercial`: corresponds to company addresses used in B2B contexts and follows the same logic as residential addresses. + * + * When a residential address is marked as disposable and the profile is complete, authentication is required to complete the order. Additionally, when a disposable residential address is used to complete a purchase, saved cards cannot be used. */ isDisposable?: boolean; /** @@ -5810,7 +6201,15 @@ export type AddCouponsResponses = { */ addressId?: string | null; /** - * Indicates whether address is disposable. + * Indicates whether the address is disposable. Addresses marked as `isDisposable = true` are not saved to the shopper's profile when the order is completed, while addresses with `isDisposable = false` definitely belong to the shopper. + * + * Behavior by address type: + * - `giftRegistry`, `pickup`, `search`, and `inStore`: always disposable, as they do not belong to the shopper navigating the cart. + * - `residential`: may be disposable. Addresses from a complete shopper profile, or entered by an authenticated shopper with a complete profile, are not disposable. All other residential addresses are disposable, including those from first-time purchases, since no complete profile exists yet. + * - `invoice`: does not have the `isDisposable` flag, since invoice addresses are of type `Address` rather than `ShippingAddress`. In practice, only authenticated shoppers can add invoice attachments to the cart, so they are never treated as disposable. + * - `commercial`: corresponds to company addresses used in B2B contexts and follows the same logic as residential addresses. + * + * When a residential address is marked as disposable and the profile is complete, authentication is required to complete the order. Additionally, when a disposable residential address is used to complete a purchase, saved cards cannot be used. */ isDisposable?: boolean; /** @@ -5863,7 +6262,7 @@ export type AddCouponsResponses = { */ itemIndex?: number; /** - * SLA selected by the customer. If the store uses the [Delivery Option](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, this field returns the delivery option ID selected for this SLA, as the example `1223d5b4-52a4-442f-ab23-01345b60be48`. + * Selected SLA. For example, `normal` or `express`. If the store uses the [Delivery Options](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, this field returns the delivery option ID selected for this SLA, for example, `1223d5b4-52a4-442f-ab23-01345b60be48`. If this field is `null` or omitted, the API automatically selects the best delivery option available, excluding pickup and scheduled delivery options. To select a pickup option or a scheduled delivery option, it must be explicitly sent in this field. For more information, see the [Add shipping address and select delivery option](https://developers.vtex.com/docs/guides/checkout-api#tag/Cart-attachments/operation/AddShippingAddress) endpoint description. */ selectedSla?: string | null; /** @@ -5879,7 +6278,7 @@ export type AddCouponsResponses = { */ slas?: Array<{ /** - * SLA ID. If the store uses the [Delivery Option](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, this field returns the delivery option ID selected for this SLA, as the example `1223d5b4-52a4-442f-ab23-01345b60be48`. + * SLA ID. If the store uses the [Delivery Options](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, this field returns the delivery option ID selected for this SLA, as the example `1223d5b4-52a4-442f-ab23-01345b60be48`. */ id?: string; /** @@ -5887,7 +6286,7 @@ export type AddCouponsResponses = { */ deliveryChannel?: string; /** - * SLA name. If the store uses the [Delivery Option](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, the value of this field will show the specific delivery option name selected for this SLA, as the example `Delivery | BRA | Up to 30 hours`. + * SLA name. If the store uses the [Delivery Options](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, the value of this field will show the specific delivery option name selected for this SLA, as the example `Delivery | BRA | Up to 30 hours`. */ name?: string; /** @@ -5916,7 +6315,7 @@ export type AddCouponsResponses = { quantity?: number; }>; /** - * Shipping estimate. For instance, Three business days will be represented `3bd`. + * Shipping estimate. For instance, Three business days will be represented `3bd`. The unit can be `bd` for business days, `d` for days, `h` for hours, or `m` for minutes. */ shippingEstimate?: string; /** @@ -6065,7 +6464,15 @@ export type AddCouponsResponses = { */ addressId?: string | null; /** - * Indicates whether address is disposable. + * Indicates whether the address is disposable. Addresses marked as `isDisposable = true` are not saved to the shopper's profile when the order is completed, while addresses with `isDisposable = false` definitely belong to the shopper. + * + * Behavior by address type: + * - `giftRegistry`, `pickup`, `search`, and `inStore`: always disposable, as they do not belong to the shopper navigating the cart. + * - `residential`: may be disposable. Addresses from a complete shopper profile, or entered by an authenticated shopper with a complete profile, are not disposable. All other residential addresses are disposable, including those from first-time purchases, since no complete profile exists yet. + * - `invoice`: does not have the `isDisposable` flag, since invoice addresses are of type `Address` rather than `ShippingAddress`. In practice, only authenticated shoppers can add invoice attachments to the cart, so they are never treated as disposable. + * - `commercial`: corresponds to company addresses used in B2B contexts and follows the same logic as residential addresses. + * + * When a residential address is marked as disposable and the profile is complete, authentication is required to complete the order. Additionally, when a disposable residential address is used to complete a purchase, saved cards cannot be used. */ isDisposable?: boolean; /** @@ -6126,7 +6533,15 @@ export type AddCouponsResponses = { */ addressId?: string | null; /** - * Indicates whether address is disposable. + * Indicates whether the address is disposable. Addresses marked as `isDisposable = true` are not saved to the shopper's profile when the order is completed, while addresses with `isDisposable = false` definitely belong to the shopper. + * + * Behavior by address type: + * - `giftRegistry`, `pickup`, `search`, and `inStore`: always disposable, as they do not belong to the shopper navigating the cart. + * - `residential`: may be disposable. Addresses from a complete shopper profile, or entered by an authenticated shopper with a complete profile, are not disposable. All other residential addresses are disposable, including those from first-time purchases, since no complete profile exists yet. + * - `invoice`: does not have the `isDisposable` flag, since invoice addresses are of type `Address` rather than `ShippingAddress`. In practice, only authenticated shoppers can add invoice attachments to the cart, so they are never treated as disposable. + * - `commercial`: corresponds to company addresses used in B2B contexts and follows the same logic as residential addresses. + * + * When a residential address is marked as disposable and the profile is complete, authentication is required to complete the order. Additionally, when a disposable residential address is used to complete a purchase, saved cards cannot be used. */ isDisposable?: boolean; /** @@ -6647,7 +7062,15 @@ export type ListPickupPpointsByLocationResponses = { */ addressId?: string | null; /** - * Is disposable. + * Indicates whether the address is disposable. Addresses marked as `isDisposable = true` are not saved to the shopper's profile when the order is completed, while addresses with `isDisposable = false` definitely belong to the shopper. + * + * Behavior by address type: + * - `giftRegistry`, `pickup`, `search`, and `inStore`: always disposable, as they do not belong to the shopper navigating the cart. + * - `residential`: may be disposable. Addresses from a complete shopper profile, or entered by an authenticated shopper with a complete profile, are not disposable. All other residential addresses are disposable, including those from first-time purchases, since no complete profile exists yet. + * - `invoice`: does not have the `isDisposable` flag, since invoice addresses are of type `Address` rather than `ShippingAddress`. In practice, only authenticated shoppers can add invoice attachments to the cart, so they are never treated as disposable. + * - `commercial`: corresponds to company addresses used in B2B contexts and follows the same logic as residential addresses. + * + * When a residential address is marked as disposable and the profile is complete, authentication is required to complete the order. Additionally, when a disposable residential address is used to complete a purchase, saved cards cannot be used. */ isDisposable?: boolean; /** @@ -7113,7 +7536,7 @@ export type PlaceOrderData = { */ itemIndex: number; /** - * Selected shipping option. If the store uses the [Delivery Option](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, this field returns the delivery option ID selected for this SLA, as the example `1223d5b4-52a4-442f-ab23-01345b60be48`. + * Selected SLA. For example, `normal` or `express`. If the store uses the [Delivery Options](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, this field returns the delivery option ID selected for this SLA, for example, `1223d5b4-52a4-442f-ab23-01345b60be48`. If this field is `null` or omitted, the API automatically selects the best delivery option available, excluding pickup and scheduled delivery options. To select a pickup option or a scheduled delivery option, it must be explicitly sent in this field. For more information, see the [Add shipping address and select delivery option](https://developers.vtex.com/docs/guides/checkout-api#tag/Cart-attachments/operation/AddShippingAddress) endpoint description. */ selectedSla: string | null; /** @@ -7129,7 +7552,7 @@ export type PlaceOrderData = { */ lockTTL?: string | null; /** - * Estimated time until delivery for the item. + * Estimated time until delivery for the item. The unit can be `bd` for business days, `d` for days, `h` for hours, or `m` for minutes. */ shippingEstimate?: string; /** @@ -7758,6 +8181,10 @@ export type PlaceOrderResponses = { * Seller logo. */ logo?: string | null; + /** + * Minimum order value configured at the seller, in cents. + */ + minimumOrderValue?: number | null; }>; /** * Information on order totals. @@ -7875,7 +8302,15 @@ export type PlaceOrderResponses = { */ addressId?: string | null; /** - * Indicates whether address is disposable. + * Indicates whether the address is disposable. Addresses marked as `isDisposable = true` are not saved to the shopper's profile when the order is completed, while addresses with `isDisposable = false` definitely belong to the shopper. + * + * Behavior by address type: + * - `giftRegistry`, `pickup`, `search`, and `inStore`: always disposable, as they do not belong to the shopper navigating the cart. + * - `residential`: may be disposable. Addresses from a complete shopper profile, or entered by an authenticated shopper with a complete profile, are not disposable. All other residential addresses are disposable, including those from first-time purchases, since no complete profile exists yet. + * - `invoice`: does not have the `isDisposable` flag, since invoice addresses are of type `Address` rather than `ShippingAddress`. In practice, only authenticated shoppers can add invoice attachments to the cart, so they are never treated as disposable. + * - `commercial`: corresponds to company addresses used in B2B contexts and follows the same logic as residential addresses. + * + * When a residential address is marked as disposable and the profile is complete, authentication is required to complete the order. Additionally, when a disposable residential address is used to complete a purchase, saved cards cannot be used. */ isDisposable?: boolean; /** @@ -7928,7 +8363,7 @@ export type PlaceOrderResponses = { */ itemIndex?: number; /** - * SLA selected by the customer. If the store uses the [Delivery Option](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, this field returns the delivery option ID selected for this SLA, as the example `1223d5b4-52a4-442f-ab23-01345b60be48`. + * Selected SLA. For example, `normal` or `express`. If the store uses the [Delivery Options](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, this field returns the delivery option ID selected for this SLA, for example, `1223d5b4-52a4-442f-ab23-01345b60be48`. If this field is `null` or omitted, the API automatically selects the best delivery option available, excluding pickup and scheduled delivery options. To select a pickup option or a scheduled delivery option, it must be explicitly sent in this field. For more information, see the [Add shipping address and select delivery option](https://developers.vtex.com/docs/guides/checkout-api#tag/Cart-attachments/operation/AddShippingAddress) endpoint description. */ selectedSla?: string | null; /** @@ -7944,7 +8379,7 @@ export type PlaceOrderResponses = { */ slas?: Array<{ /** - * SLA ID. If the store uses the [Delivery Option](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, this field returns the delivery option ID selected for this SLA, as the example `1223d5b4-52a4-442f-ab23-01345b60be48`. + * SLA ID. If the store uses the [Delivery Options](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, this field returns the delivery option ID selected for this SLA, as the example `1223d5b4-52a4-442f-ab23-01345b60be48`. */ id?: string; /** @@ -7952,7 +8387,7 @@ export type PlaceOrderResponses = { */ deliveryChannel?: string; /** - * SLA name. If the store uses the [Delivery Option](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, the value of this field will show the specific delivery option name selected for this SLA, as the example `Delivery | BRA | Up to 30 hours`. + * SLA name. If the store uses the [Delivery Options](https://help.vtex.com/en/docs/tutorials/delivery-options-beta) feature, the value of this field will show the specific delivery option name selected for this SLA, as the example `Delivery | BRA | Up to 30 hours`. */ name?: string; /** @@ -7981,7 +8416,7 @@ export type PlaceOrderResponses = { quantity?: number; }>; /** - * Shipping estimate. For instance, Three business days will be represented `3bd`. + * Shipping estimate. For instance, Three business days will be represented `3bd`. The unit can be `bd` for business days, `d` for days, `h` for hours, or `m` for minutes. */ shippingEstimate?: string; /** @@ -8130,7 +8565,15 @@ export type PlaceOrderResponses = { */ addressId?: string | null; /** - * Indicates whether address is disposable. + * Indicates whether the address is disposable. Addresses marked as `isDisposable = true` are not saved to the shopper's profile when the order is completed, while addresses with `isDisposable = false` definitely belong to the shopper. + * + * Behavior by address type: + * - `giftRegistry`, `pickup`, `search`, and `inStore`: always disposable, as they do not belong to the shopper navigating the cart. + * - `residential`: may be disposable. Addresses from a complete shopper profile, or entered by an authenticated shopper with a complete profile, are not disposable. All other residential addresses are disposable, including those from first-time purchases, since no complete profile exists yet. + * - `invoice`: does not have the `isDisposable` flag, since invoice addresses are of type `Address` rather than `ShippingAddress`. In practice, only authenticated shoppers can add invoice attachments to the cart, so they are never treated as disposable. + * - `commercial`: corresponds to company addresses used in B2B contexts and follows the same logic as residential addresses. + * + * When a residential address is marked as disposable and the profile is complete, authentication is required to complete the order. Additionally, when a disposable residential address is used to complete a purchase, saved cards cannot be used. */ isDisposable?: boolean; /** @@ -8191,7 +8634,15 @@ export type PlaceOrderResponses = { */ addressId?: string | null; /** - * Indicates whether address is disposable. + * Indicates whether the address is disposable. Addresses marked as `isDisposable = true` are not saved to the shopper's profile when the order is completed, while addresses with `isDisposable = false` definitely belong to the shopper. + * + * Behavior by address type: + * - `giftRegistry`, `pickup`, `search`, and `inStore`: always disposable, as they do not belong to the shopper navigating the cart. + * - `residential`: may be disposable. Addresses from a complete shopper profile, or entered by an authenticated shopper with a complete profile, are not disposable. All other residential addresses are disposable, including those from first-time purchases, since no complete profile exists yet. + * - `invoice`: does not have the `isDisposable` flag, since invoice addresses are of type `Address` rather than `ShippingAddress`. In practice, only authenticated shoppers can add invoice attachments to the cart, so they are never treated as disposable. + * - `commercial`: corresponds to company addresses used in B2B contexts and follows the same logic as residential addresses. + * + * When a residential address is marked as disposable and the profile is complete, authentication is required to complete the order. Additionally, when a disposable residential address is used to complete a purchase, saved cards cannot be used. */ isDisposable?: boolean; /** diff --git a/vtex/server/generated/checkout/zod.gen.ts b/vtex/server/generated/checkout/zod.gen.ts index 3c2821ff..764e763b 100644 --- a/vtex/server/generated/checkout/zod.gen.ts +++ b/vtex/server/generated/checkout/zod.gen.ts @@ -16,7 +16,10 @@ export const zOrderForm = z.object({ ])), allowManualPrice: z.optional(z.boolean()), canEditData: z.optional(z.boolean()), - userProfileId: z.optional(z.string()), + userProfileId: z.optional(z.union([ + z.string(), + z.null() + ])), profileProvider: z.optional(z.string()), availableAccounts: z.optional(z.array(z.string())), availableAddresses: z.optional(z.array(z.object({ @@ -55,7 +58,10 @@ export const zOrderForm = z.object({ id: z.optional(z.string()), productId: z.optional(z.string()), productRefId: z.optional(z.string()), - refId: z.optional(z.string()), + refId: z.optional(z.union([ + z.string(), + z.null() + ])), ean: z.optional(z.union([ z.string(), z.null() @@ -129,7 +135,10 @@ export const zOrderForm = z.object({ name: z.optional(z.string()), price: z.optional(z.int()) }))), - attachments: z.optional(z.array(z.string())), + attachments: z.optional(z.array(z.object({ + name: z.optional(z.string()), + content: z.optional(z.record(z.string(), z.unknown())) + }))), priceTags: z.optional(z.array(z.object({ identifier: z.optional(z.union([ z.string(), @@ -163,7 +172,10 @@ export const zOrderForm = z.object({ address: z.optional(z.union([ z.object({ addressType: z.optional(z.string()), - receiverName: z.optional(z.string()), + receiverName: z.optional(z.union([ + z.string(), + z.null() + ])), addressId: z.optional(z.union([ z.string(), z.null() @@ -284,7 +296,7 @@ export const zOrderForm = z.object({ z.string(), z.null() ])), - pickupDistance: z.optional(z.int()), + pickupDistance: z.optional(z.number()), polygonName: z.optional(z.union([ z.string(), z.null() @@ -299,7 +311,10 @@ export const zOrderForm = z.object({ }))), selectedAddresses: z.optional(z.array(z.object({ addressType: z.optional(z.string()), - receiverName: z.optional(z.string()), + receiverName: z.optional(z.union([ + z.string(), + z.null() + ])), addressId: z.optional(z.union([ z.string(), z.null() @@ -324,7 +339,10 @@ export const zOrderForm = z.object({ }))), availableAddresses: z.optional(z.array(z.object({ addressType: z.optional(z.string()), - receiverName: z.optional(z.string()), + receiverName: z.optional(z.union([ + z.string(), + z.null() + ])), addressId: z.optional(z.union([ z.string(), z.null() @@ -455,6 +473,10 @@ export const zOrderForm = z.object({ logo: z.optional(z.union([ z.string(), z.null() + ])), + minimumOrderValue: z.optional(z.union([ + z.int(), + z.null() ])) }))), clientPreferencesData: z.optional(z.object({ @@ -534,7 +556,10 @@ export const zOrderForm = z.object({ name: z.optional(z.string()), skuName: z.optional(z.string()), productId: z.optional(z.string()), - refId: z.optional(z.string()), + refId: z.optional(z.union([ + z.string(), + z.null() + ])), ean: z.optional(z.union([ z.string(), z.null() @@ -555,10 +580,13 @@ export const zOrderForm = z.object({ z.record(z.string(), z.unknown()), z.null() ])), - itemsOrdination: z.optional(z.object({ - criteria: z.optional(z.string()), - ascending: z.optional(z.boolean()) - })) + itemsOrdination: z.optional(z.union([ + z.object({ + criteria: z.optional(z.string()), + ascending: z.optional(z.boolean()) + }), + z.null() + ])) }); /** @@ -841,6 +869,21 @@ export const zItemsData = z.object({ }) }); +export const zDeleteApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexPriceData = z.object({ + body: z.optional(z.never()), + path: z.object({ + orderFormId: z.string(), + itemIndex: z.string() + }), + query: z.optional(z.object({ + individualShippingEstimates: z.optional(z.boolean()) + })), + headers: z.object({ + 'Content-Type': z.string().default('application/json'), + Accept: z.string().default('application/json') + }) +}); + export const zPriceChangeData = z.object({ body: zPriceChangeRequest, path: z.object({ @@ -1036,6 +1079,85 @@ export const zAddPaymentDataData = z.object({ }) }); +export const zDeleteApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexAttachmentsByAttachmentNameData = z.object({ + body: z.optional(z.never()), + path: z.object({ + orderFormId: z.string(), + itemIndex: z.string(), + attachmentName: z.string() + }), + query: z.optional(z.object({ + individualShippingEstimates: z.optional(z.boolean()) + })), + headers: z.object({ + 'Content-Type': z.string().default('application/json'), + Accept: z.string().default('application/json') + }) +}); + +export const zPostApiCheckoutPubOrderFormByOrderFormIdItemsByItemIndexAttachmentsByAttachmentNameData = z.object({ + body: z.object({ + content: z.record(z.string(), z.unknown()) + }), + path: z.object({ + orderFormId: z.string(), + itemIndex: z.string(), + attachmentName: z.string() + }), + query: z.optional(z.object({ + individualShippingEstimates: z.optional(z.boolean()) + })), + headers: z.object({ + 'Content-Type': z.string().default('application/json'), + Accept: z.string().default('application/json') + }) +}); + +export const zDeleteApiCheckoutPubOrderFormByOrderFormIdAttachmentsSubscriptionDataData = z.object({ + body: z.object({ + subscriptions: z.array(z.record(z.string(), z.unknown())) + }), + path: z.object({ + orderFormId: z.string() + }), + query: z.optional(z.object({ + individualShippingEstimates: z.optional(z.boolean()) + })), + headers: z.object({ + 'Content-Type': z.string().default('application/json'), + Accept: z.string().default('application/json') + }) +}); + +export const zPostApiCheckoutPubOrderFormByOrderFormIdAttachmentsSubscriptionDataData = z.object({ + body: z.object({ + subscriptions: z.array(z.object({ + itemIndex: z.int(), + plan: z.object({ + frequency: z.object({ + interval: z.int(), + periodicity: z.string() + }), + validity: z.optional(z.object({ + begin: z.optional(z.string()), + end: z.optional(z.string()) + })), + type: z.string() + }) + })) + }), + path: z.object({ + orderFormId: z.string() + }), + query: z.optional(z.object({ + individualShippingEstimates: z.optional(z.boolean()) + })), + headers: z.object({ + 'Content-Type': z.string().default('application/json'), + Accept: z.string().default('application/json') + }) +}); + export const zAddMerchantContextDataData = z.object({ body: z.object({ salesAssociateData: z.object({ @@ -1251,6 +1373,18 @@ export const zUpdateorderFormconfigurationData = z.object({ }) }); +export const zCreateorderFormconfigurationData = z.object({ + body: zUpdateorderFormconfigurationRequest, + path: z.optional(z.never()), + query: z.optional(z.object({ + individualShippingEstimates: z.optional(z.boolean()) + })), + headers: z.object({ + 'Content-Type': z.string().default('application/json'), + Accept: z.string().default('application/json') + }) +}); + export const zGetWindowToChangeSellerData = z.object({ body: z.optional(z.never()), path: z.optional(z.never()), diff --git a/vtex/server/generated/default-values/types.gen.ts b/vtex/server/generated/default-values/types.gen.ts index 1817ae36..68473dab 100644 --- a/vtex/server/generated/default-values/types.gen.ts +++ b/vtex/server/generated/default-values/types.gen.ts @@ -9,7 +9,7 @@ export type ClientOptions = { */ export type DefaultValuesRequest = { /** - * Unique identifier of the default values document. + * Unique identifier of the organizational unit. This value is used as the default values document ID. */ id: string; /** diff --git a/vtex/server/generated/delivery-promise-notification/index.ts b/vtex/server/generated/delivery-promise-notification/index.ts index 7c52d1fe..6398b6d2 100644 --- a/vtex/server/generated/delivery-promise-notification/index.ts +++ b/vtex/server/generated/delivery-promise-notification/index.ts @@ -1,4 +1,4 @@ // This file is auto-generated by @hey-api/openapi-ts -export { type Options, patchDeliveryPromisesExternalSellersBySellerIdItemsByItemId, putDeliveryPromisesExternalSellersBySellerIdProducts } from './sdk.gen'; -export type { Accept, ClientOptions, ContentType, PatchDeliveryPromisesExternalSellersBySellerIdItemsByItemIdData, PatchDeliveryPromisesExternalSellersBySellerIdItemsByItemIdError, PatchDeliveryPromisesExternalSellersBySellerIdItemsByItemIdErrors, PatchDeliveryPromisesExternalSellersBySellerIdItemsByItemIdResponses, PutDeliveryPromisesExternalSellersBySellerIdProductsData, PutDeliveryPromisesExternalSellersBySellerIdProductsError, PutDeliveryPromisesExternalSellersBySellerIdProductsErrors, PutDeliveryPromisesExternalSellersBySellerIdProductsResponses } from './types.gen'; +export { type Options, patchApiDeliveryPromisesExternalSellersBySellerIdItemsByItemId, putApiDeliveryPromisesExternalSellersBySellerIdProducts } from './sdk.gen'; +export type { Accept, ClientOptions, ContentType, PatchApiDeliveryPromisesExternalSellersBySellerIdItemsByItemIdData, PatchApiDeliveryPromisesExternalSellersBySellerIdItemsByItemIdError, PatchApiDeliveryPromisesExternalSellersBySellerIdItemsByItemIdErrors, PatchApiDeliveryPromisesExternalSellersBySellerIdItemsByItemIdResponses, PutApiDeliveryPromisesExternalSellersBySellerIdProductsData, PutApiDeliveryPromisesExternalSellersBySellerIdProductsError, PutApiDeliveryPromisesExternalSellersBySellerIdProductsErrors, PutApiDeliveryPromisesExternalSellersBySellerIdProductsResponses } from './types.gen'; diff --git a/vtex/server/generated/delivery-promise-notification/sdk.gen.ts b/vtex/server/generated/delivery-promise-notification/sdk.gen.ts index 35d5951a..4b21f9e8 100644 --- a/vtex/server/generated/delivery-promise-notification/sdk.gen.ts +++ b/vtex/server/generated/delivery-promise-notification/sdk.gen.ts @@ -2,7 +2,7 @@ import type { Client, Options as Options2, TDataShape } from './client'; import { client } from './client.gen'; -import type { PatchDeliveryPromisesExternalSellersBySellerIdItemsByItemIdData, PatchDeliveryPromisesExternalSellersBySellerIdItemsByItemIdErrors, PatchDeliveryPromisesExternalSellersBySellerIdItemsByItemIdResponses, PutDeliveryPromisesExternalSellersBySellerIdProductsData, PutDeliveryPromisesExternalSellersBySellerIdProductsErrors, PutDeliveryPromisesExternalSellersBySellerIdProductsResponses } from './types.gen'; +import type { PatchApiDeliveryPromisesExternalSellersBySellerIdItemsByItemIdData, PatchApiDeliveryPromisesExternalSellersBySellerIdItemsByItemIdErrors, PatchApiDeliveryPromisesExternalSellersBySellerIdItemsByItemIdResponses, PutApiDeliveryPromisesExternalSellersBySellerIdProductsData, PutApiDeliveryPromisesExternalSellersBySellerIdProductsErrors, PutApiDeliveryPromisesExternalSellersBySellerIdProductsResponses } from './types.gen'; export type Options = Options2 & { /** @@ -21,7 +21,17 @@ export type Optionsℹ️ This API is intended only for [**external sellers**](https://help.vtex.com/en/tutorial/integration-guide-for-marketplaces-seller-non-vtex--yMji0ow0rQuYgQsg26Kus). It is not required for [franchise accounts](https://help.vtex.com/en/docs/tutorials/what-is-a-franchise-account), sellers using [VTEX Seller Portal](https://help.vtex.com/en/docs/tutorials/how-to-set-up-your-store-on-seller-portal), or [VTEX sellers](https://help.vtex.com/en/tutorial/integrating-with-marketplace) already integrated into the [marketplace ecosystem](https://help.vtex.com/en/tutorial/integrating-with-marketplace). In these cases, availability and delivery options are managed natively by VTEX. + * + * Use this endpoint to **create or fully replace** the delivery promises for one or more external sellers' items. Each request sends the complete set of promises for the items included in the payload. + * + * ## Making a SKU unavailable + * + * To make a SKU unavailable for a given delivery context, send a `PUT` request with `availability: 0`. This action explicitly updates the [Delivery Promise](https://help.vtex.com/en/tutorial/delivery-promise-beta--p9EJH9GgxL0JceA6dBswd) state. Unlike [Seller Portal](https://help.vtex.com/en/docs/tutorials/how-to-set-up-your-store-on-seller-portal) integrations, this change is not automatically propagated and must be triggered via API. * * ## Permissions * @@ -35,16 +45,30 @@ export type Options❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. */ -export const putDeliveryPromisesExternalSellersBySellerIdProducts = (options: Options) => (options.client ?? client).put({ +export const putApiDeliveryPromisesExternalSellersBySellerIdProducts = (options: Options) => (options.client ?? client).put({ security: [{ name: 'X-VTEX-API-AppKey', type: 'apiKey' }, { name: 'X-VTEX-API-AppToken', type: 'apiKey' }], - url: '/delivery-promises/external-sellers/{sellerId}/products', + url: '/api/delivery-promises/external-sellers/{sellerId}/products', ...options }); /** * Update delivery promises for an external seller's item * - * Updates availability and delivery promises for a specific item that belongs to an external seller. + * Updates one or more delivery promises of a single [external seller's](https://help.vtex.com/en/tutorial/integration-guide-for-marketplaces-seller-non-vtex--yMji0ow0rQuYgQsg26Kus) item, identified by the path parameter `itemId`. + * + * The Delivery Promise Notification API notifies the VTEX store of the external seller's product availability and delivery promises — that is, in which delivery zones, times, and methods the product is available. + * + * >ℹ️ This API is intended only for [**external sellers**](https://help.vtex.com/en/tutorial/integration-guide-for-marketplaces-seller-non-vtex--yMji0ow0rQuYgQsg26Kus). It is not required for [franchise accounts](https://help.vtex.com/en/docs/tutorials/what-is-a-franchise-account), sellers using [VTEX Seller Portal](https://help.vtex.com/en/docs/tutorials/how-to-set-up-your-store-on-seller-portal), or [VTEX sellers](https://help.vtex.com/en/tutorial/integrating-with-marketplace) already integrated into the [marketplace ecosystem](https://help.vtex.com/en/tutorial/integrating-with-marketplace). In these cases, availability and delivery options are managed natively by VTEX. + * + * Use this endpoint to update one or more delivery promises of a single external seller's item. A `PATCH` request always targets a single `itemId`, but you can update as many promises as needed within that item. + * + * Each promise to be updated must be identified by `id` (the same value previously sent as `deliveryInfo.id` in a `PUT` request). This field is required because, without it, the API cannot determine which promise of that item should be updated. + * + * >ℹ️ Before running a `PATCH` for an item, that item must have been previously created with a `PUT` request. `PATCH` is an update operation whose key is the `id` previously sent in the Update external product availability request. + * + * ## Making a SKU unavailable + * + * To make a SKU unavailable for a given delivery context, send a `PATCH` request with `availability: 0`. This action explicitly updates the [Delivery Promise](https://help.vtex.com/en/tutorial/delivery-promise-beta--p9EJH9GgxL0JceA6dBswd) state. Unlike [Seller Portal](https://help.vtex.com/en/docs/tutorials/how-to-set-up-your-store-on-seller-portal) integrations, this change is not automatically propagated and must be triggered via API. * * ## Permissions * @@ -59,8 +83,8 @@ export const putDeliveryPromisesExternalSellersBySellerIdProducts = ❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. */ -export const patchDeliveryPromisesExternalSellersBySellerIdItemsByItemId = (options: Options) => (options.client ?? client).patch({ +export const patchApiDeliveryPromisesExternalSellersBySellerIdItemsByItemId = (options: Options) => (options.client ?? client).patch({ security: [{ name: 'X-VTEX-API-AppKey', type: 'apiKey' }, { name: 'X-VTEX-API-AppToken', type: 'apiKey' }], - url: '/delivery-promises/external-sellers/{sellerId}/items/{itemId}', + url: '/api/delivery-promises/external-sellers/{sellerId}/items/{itemId}', ...options }); diff --git a/vtex/server/generated/delivery-promise-notification/types.gen.ts b/vtex/server/generated/delivery-promise-notification/types.gen.ts index ca5be349..d43cc8d8 100644 --- a/vtex/server/generated/delivery-promise-notification/types.gen.ts +++ b/vtex/server/generated/delivery-promise-notification/types.gen.ts @@ -1,7 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts export type ClientOptions = { - baseUrl: 'https://{accountName}.{environment}.com.br/api' | (string & {}); + baseUrl: 'https://{accountName}.{environment}.com.br' | (string & {}); }; /** @@ -14,18 +14,18 @@ export type ContentType = string; */ export type Accept = string; -export type PutDeliveryPromisesExternalSellersBySellerIdProductsData = { - body: { +export type PutApiDeliveryPromisesExternalSellersBySellerIdProductsData = { + body: Array<{ /** * Unique identifier of the binding of the seller with the SKU. */ itemId: string; /** - * The product unique identifier. + * Product unique identifier. */ productId?: string; /** - * Total available items. + * Total available items for the SKU across all promises. Send `0` to make the SKU unavailable in this delivery context. */ availability: number; /** @@ -33,11 +33,11 @@ export type PutDeliveryPromisesExternalSellersBySellerIdProductsData = { */ promises: Array<{ /** - * Available items for this delivery promise. + * Available items for this delivery promise. Send `0` to make this specific promise unavailable. */ availability: number; /** - * Delivery channel type. + * Delivery channel type. Accepted values are `delivery` and `pickup-in-point`. */ deliveryChannel: 'delivery' | 'pickup-in-point'; /** @@ -45,11 +45,11 @@ export type PutDeliveryPromisesExternalSellersBySellerIdProductsData = { */ deliveryZoneIds: Array<'BRA_COUNTRY' | 'BRA_REGION_NORTE' | 'BRA_REGION_CENTRO_OESTE' | 'BRA_REGION_NORDESTE' | 'BRA_REGION_SUDESTE' | 'BRA_REGION_SUL' | 'BRA_SUBSTATE_DF_CAPITAL' | 'BRA_SUBSTATE_DF_INTERIOR' | 'BRA_SUBSTATE_GO_CAPITAL' | 'BRA_SUBSTATE_GO_INTERIOR' | 'BRA_SUBSTATE_MT_CAPITAL' | 'BRA_SUBSTATE_MT_INTERIOR' | 'BRA_SUBSTATE_MS_CAPITAL' | 'BRA_SUBSTATE_MS_INTERIOR' | 'BRA_SUBSTATE_BA_CAPITAL' | 'BRA_SUBSTATE_BA_REG_METROPOLITANA' | 'BRA_SUBSTATE_BA_INTERIOR' | 'BRA_SUBSTATE_SE_CAPITAL' | 'BRA_SUBSTATE_SE_INTERIOR' | 'BRA_SUBSTATE_PE_CAPITAL' | 'BRA_SUBSTATE_PE_REG_METROPOLITANA' | 'BRA_SUBSTATE_PE_INTERIOR' | 'BRA_SUBSTATE_AL_CAPITAL' | 'BRA_SUBSTATE_AL_INTERIOR' | 'BRA_SUBSTATE_PB_CAPITAL' | 'BRA_SUBSTATE_PB_INTERIOR' | 'BRA_SUBSTATE_RN_CAPITAL' | 'BRA_SUBSTATE_RN_INTERIOR' | 'BRA_SUBSTATE_CE_CAPITAL' | 'BRA_SUBSTATE_CE_REG_METROPOLITANA' | 'BRA_SUBSTATE_CE_INTERIOR' | 'BRA_SUBSTATE_PI_CAPITAL' | 'BRA_SUBSTATE_PI_INTERIOR' | 'BRA_SUBSTATE_MA_CAPITAL' | 'BRA_SUBSTATE_MA_INTERIOR' | 'BRA_SUBSTATE_PA_CAPITAL' | 'BRA_SUBSTATE_PA_REG_METROPOLITANA' | 'BRA_SUBSTATE_PA_INTERIOR' | 'BRA_SUBSTATE_AP_CAPITAL' | 'BRA_SUBSTATE_AP_INTERIOR' | 'BRA_SUBSTATE_AM_CAPITAL' | 'BRA_SUBSTATE_AM_INTERIOR' | 'BRA_SUBSTATE_RR_CAPITAL' | 'BRA_SUBSTATE_RR_INTERIOR' | 'BRA_SUBSTATE_AC_CAPITAL' | 'BRA_SUBSTATE_AC_INTERIOR' | 'BRA_SUBSTATE_TO_CAPITAL' | 'BRA_SUBSTATE_TO_INTERIOR' | 'BRA_SUBSTATE_RO_CAPITAL' | 'BRA_SUBSTATE_RO_INTERIOR' | 'BRA_SUBSTATE_SP_CAPITAL' | 'BRA_SUBSTATE_SP_REG_METROPOLITANA' | 'BRA_SUBSTATE_SP_LITORAL' | 'BRA_SUBSTATE_SP_INTERIOR' | 'BRA_SUBSTATE_RJ_CAPITAL' | 'BRA_SUBSTATE_RJ_REG_METROPOLITANA' | 'BRA_SUBSTATE_RJ_INTERIOR' | 'BRA_SUBSTATE_ES_CAPITAL' | 'BRA_SUBSTATE_ES_INTERIOR' | 'BRA_SUBSTATE_MG_CAPITAL' | 'BRA_SUBSTATE_MG_REG_METROPOLITANA' | 'BRA_SUBSTATE_MG_INTERIOR' | 'BRA_SUBSTATE_PR_CAPITAL' | 'BRA_SUBSTATE_PR_REG_METROPOLITANA' | 'BRA_SUBSTATE_PR_INTERIOR' | 'BRA_SUBSTATE_SC_CAPITAL' | 'BRA_SUBSTATE_SC_REG_METROPOLITANA' | 'BRA_SUBSTATE_SC_INTERIOR' | 'BRA_SUBSTATE_RS_CAPITAL' | 'BRA_SUBSTATE_RS_REG_METROPOLITANA' | 'BRA_SUBSTATE_RS_INTERIOR' | 'USA_COUNTRY' | 'USA_DIVISION_NEW_ENGLAND' | 'USA_STATE_CT' | 'USA_STATE_ME' | 'USA_STATE_MA' | 'USA_STATE_NH' | 'USA_STATE_RI' | 'USA_STATE_VT' | 'USA_DIVISION_MIDDLE_ATLANTIC' | 'USA_STATE_NJ' | 'USA_STATE_NY' | 'USA_STATE_PA' | 'USA_DIVISION_EAST_NORTH_CENTRAL' | 'USA_STATE_IL' | 'USA_STATE_IN' | 'USA_STATE_MI' | 'USA_STATE_OH' | 'USA_STATE_WI' | 'USA_DIVISION_WEST_NORTH_CENTRAL' | 'USA_STATE_IA' | 'USA_STATE_KS' | 'USA_STATE_MN' | 'USA_STATE_MO' | 'USA_STATE_NE' | 'USA_STATE_ND' | 'USA_STATE_SD' | 'USA_DIVISION_SOUTH_ATLANTIC' | 'USA_STATE_DE' | 'USA_STATE_FL' | 'USA_STATE_GA' | 'USA_STATE_MD' | 'USA_STATE_NC' | 'USA_STATE_SC' | 'USA_STATE_VA' | 'USA_STATE_WV' | 'USA_STATE_DC' | 'USA_DIVISION_EAST_SOUTH_CENTRAL' | 'USA_STATE_AL' | 'USA_STATE_KY' | 'USA_STATE_MS' | 'USA_STATE_TN' | 'USA_DIVISION_WEST_SOUTH_CENTRAL' | 'USA_STATE_AR' | 'USA_STATE_LA' | 'USA_STATE_OK' | 'USA_STATE_TX' | 'USA_DIVISION_MOUNTAIN' | 'USA_STATE_AZ' | 'USA_STATE_CO' | 'USA_STATE_ID' | 'USA_STATE_MT' | 'USA_STATE_NV' | 'USA_STATE_NM' | 'USA_STATE_UT' | 'USA_STATE_WY' | 'USA_DIVISION_PACIFIC' | 'USA_STATE_AK' | 'USA_STATE_CA' | 'USA_STATE_HI' | 'USA_STATE_OR' | 'USA_STATE_WA'>; /** - * Delivery method details. + * Delivery method details. The `id` value sent here is the key used to update this promise later via [Update delivery promises for an external seller's item](https://developers.vtex.com/docs/api-reference/delivery-promise-notification-api#patch-/delivery-promises/external-sellers/-sellerId-/items/-itemId-) endpoint. */ deliveryInfo?: { /** - * Unique identifier of the delivery method. + * Unique identifier of the delivery method. This value is the key used to update this promise later via [Update delivery promises for an external seller's item](https://developers.vtex.com/docs/api-reference/delivery-promise-notification-api#patch-/delivery-promises/external-sellers/-sellerId-/items/-itemId-) endpoint. */ id?: string; /** @@ -62,7 +62,7 @@ export type PutDeliveryPromisesExternalSellersBySellerIdProductsData = { deliveryTime?: string; }; }>; - }; + }>; headers: { /** * Type of the content being sent. @@ -85,10 +85,10 @@ export type PutDeliveryPromisesExternalSellersBySellerIdProductsData = { */ an: string; }; - url: '/delivery-promises/external-sellers/{sellerId}/products'; + url: '/api/delivery-promises/external-sellers/{sellerId}/products'; }; -export type PutDeliveryPromisesExternalSellersBySellerIdProductsErrors = { +export type PutApiDeliveryPromisesExternalSellersBySellerIdProductsErrors = { /** * Unauthorized */ @@ -108,7 +108,7 @@ export type PutDeliveryPromisesExternalSellersBySellerIdProductsErrors = { error?: string; }; /** - * Too many requests + * Too Many Requests */ 429: { /** @@ -117,7 +117,7 @@ export type PutDeliveryPromisesExternalSellersBySellerIdProductsErrors = { error?: string; }; /** - * Internal server error + * Internal Server Error */ 500: { /** @@ -127,50 +127,50 @@ export type PutDeliveryPromisesExternalSellersBySellerIdProductsErrors = { }; }; -export type PutDeliveryPromisesExternalSellersBySellerIdProductsError = PutDeliveryPromisesExternalSellersBySellerIdProductsErrors[keyof PutDeliveryPromisesExternalSellersBySellerIdProductsErrors]; +export type PutApiDeliveryPromisesExternalSellersBySellerIdProductsError = PutApiDeliveryPromisesExternalSellersBySellerIdProductsErrors[keyof PutApiDeliveryPromisesExternalSellersBySellerIdProductsErrors]; -export type PutDeliveryPromisesExternalSellersBySellerIdProductsResponses = { +export type PutApiDeliveryPromisesExternalSellersBySellerIdProductsResponses = { /** * Accept */ 202: unknown; }; -export type PatchDeliveryPromisesExternalSellersBySellerIdItemsByItemIdData = { +export type PatchApiDeliveryPromisesExternalSellersBySellerIdItemsByItemIdData = { /** * Delivery promises update payload. */ body: { /** - * Total available units for the item across all promises. + * Total available items for the SKU across all promises. Send `0` to make the SKU unavailable in this delivery context. */ availability: number; /** - * List of delivery promises to set or update. + * List of delivery promises. */ promises: Array<{ /** - * Units allocated to this specific promise. + * Available items for this delivery promise. Send `0` to make this specific promise unavailable. */ availability: number; /** - * Delivery channel name. + * Delivery channel type. Accepted values are `delivery` and `pickup-in-point`. */ - deliveryChannel?: string; + deliveryChannel?: 'delivery' | 'pickup-in-point'; /** - * List of delivery zone identifiers applicable to this promise. + * List of delivery zones where the item is available. */ deliveryZoneIds: Array<'BRA_COUNTRY' | 'BRA_REGION_NORTE' | 'BRA_REGION_CENTRO_OESTE' | 'BRA_REGION_NORDESTE' | 'BRA_REGION_SUDESTE' | 'BRA_REGION_SUL' | 'BRA_SUBSTATE_DF_CAPITAL' | 'BRA_SUBSTATE_DF_INTERIOR' | 'BRA_SUBSTATE_GO_CAPITAL' | 'BRA_SUBSTATE_GO_INTERIOR' | 'BRA_SUBSTATE_MT_CAPITAL' | 'BRA_SUBSTATE_MT_INTERIOR' | 'BRA_SUBSTATE_MS_CAPITAL' | 'BRA_SUBSTATE_MS_INTERIOR' | 'BRA_SUBSTATE_BA_CAPITAL' | 'BRA_SUBSTATE_BA_REG_METROPOLITANA' | 'BRA_SUBSTATE_BA_INTERIOR' | 'BRA_SUBSTATE_SE_CAPITAL' | 'BRA_SUBSTATE_SE_INTERIOR' | 'BRA_SUBSTATE_PE_CAPITAL' | 'BRA_SUBSTATE_PE_REG_METROPOLITANA' | 'BRA_SUBSTATE_PE_INTERIOR' | 'BRA_SUBSTATE_AL_CAPITAL' | 'BRA_SUBSTATE_AL_INTERIOR' | 'BRA_SUBSTATE_PB_CAPITAL' | 'BRA_SUBSTATE_PB_INTERIOR' | 'BRA_SUBSTATE_RN_CAPITAL' | 'BRA_SUBSTATE_RN_INTERIOR' | 'BRA_SUBSTATE_CE_CAPITAL' | 'BRA_SUBSTATE_CE_REG_METROPOLITANA' | 'BRA_SUBSTATE_CE_INTERIOR' | 'BRA_SUBSTATE_PI_CAPITAL' | 'BRA_SUBSTATE_PI_INTERIOR' | 'BRA_SUBSTATE_MA_CAPITAL' | 'BRA_SUBSTATE_MA_INTERIOR' | 'BRA_SUBSTATE_PA_CAPITAL' | 'BRA_SUBSTATE_PA_REG_METROPOLITANA' | 'BRA_SUBSTATE_PA_INTERIOR' | 'BRA_SUBSTATE_AP_CAPITAL' | 'BRA_SUBSTATE_AP_INTERIOR' | 'BRA_SUBSTATE_AM_CAPITAL' | 'BRA_SUBSTATE_AM_INTERIOR' | 'BRA_SUBSTATE_RR_CAPITAL' | 'BRA_SUBSTATE_RR_INTERIOR' | 'BRA_SUBSTATE_AC_CAPITAL' | 'BRA_SUBSTATE_AC_INTERIOR' | 'BRA_SUBSTATE_TO_CAPITAL' | 'BRA_SUBSTATE_TO_INTERIOR' | 'BRA_SUBSTATE_RO_CAPITAL' | 'BRA_SUBSTATE_RO_INTERIOR' | 'BRA_SUBSTATE_SP_CAPITAL' | 'BRA_SUBSTATE_SP_REG_METROPOLITANA' | 'BRA_SUBSTATE_SP_LITORAL' | 'BRA_SUBSTATE_SP_INTERIOR' | 'BRA_SUBSTATE_RJ_CAPITAL' | 'BRA_SUBSTATE_RJ_REG_METROPOLITANA' | 'BRA_SUBSTATE_RJ_INTERIOR' | 'BRA_SUBSTATE_ES_CAPITAL' | 'BRA_SUBSTATE_ES_INTERIOR' | 'BRA_SUBSTATE_MG_CAPITAL' | 'BRA_SUBSTATE_MG_REG_METROPOLITANA' | 'BRA_SUBSTATE_MG_INTERIOR' | 'BRA_SUBSTATE_PR_CAPITAL' | 'BRA_SUBSTATE_PR_REG_METROPOLITANA' | 'BRA_SUBSTATE_PR_INTERIOR' | 'BRA_SUBSTATE_SC_CAPITAL' | 'BRA_SUBSTATE_SC_REG_METROPOLITANA' | 'BRA_SUBSTATE_SC_INTERIOR' | 'BRA_SUBSTATE_RS_CAPITAL' | 'BRA_SUBSTATE_RS_REG_METROPOLITANA' | 'BRA_SUBSTATE_RS_INTERIOR' | 'USA_COUNTRY' | 'USA_DIVISION_NEW_ENGLAND' | 'USA_STATE_CT' | 'USA_STATE_ME' | 'USA_STATE_MA' | 'USA_STATE_NH' | 'USA_STATE_RI' | 'USA_STATE_VT' | 'USA_DIVISION_MIDDLE_ATLANTIC' | 'USA_STATE_NJ' | 'USA_STATE_NY' | 'USA_STATE_PA' | 'USA_DIVISION_EAST_NORTH_CENTRAL' | 'USA_STATE_IL' | 'USA_STATE_IN' | 'USA_STATE_MI' | 'USA_STATE_OH' | 'USA_STATE_WI' | 'USA_DIVISION_WEST_NORTH_CENTRAL' | 'USA_STATE_IA' | 'USA_STATE_KS' | 'USA_STATE_MN' | 'USA_STATE_MO' | 'USA_STATE_NE' | 'USA_STATE_ND' | 'USA_STATE_SD' | 'USA_DIVISION_SOUTH_ATLANTIC' | 'USA_STATE_DE' | 'USA_STATE_FL' | 'USA_STATE_GA' | 'USA_STATE_MD' | 'USA_STATE_NC' | 'USA_STATE_SC' | 'USA_STATE_VA' | 'USA_STATE_WV' | 'USA_STATE_DC' | 'USA_DIVISION_EAST_SOUTH_CENTRAL' | 'USA_STATE_AL' | 'USA_STATE_KY' | 'USA_STATE_MS' | 'USA_STATE_TN' | 'USA_DIVISION_WEST_SOUTH_CENTRAL' | 'USA_STATE_AR' | 'USA_STATE_LA' | 'USA_STATE_OK' | 'USA_STATE_TX' | 'USA_DIVISION_MOUNTAIN' | 'USA_STATE_AZ' | 'USA_STATE_CO' | 'USA_STATE_ID' | 'USA_STATE_MT' | 'USA_STATE_NV' | 'USA_STATE_NM' | 'USA_STATE_UT' | 'USA_STATE_WY' | 'USA_DIVISION_PACIFIC' | 'USA_STATE_AK' | 'USA_STATE_CA' | 'USA_STATE_HI' | 'USA_STATE_OR' | 'USA_STATE_WA'>; /** - * Unique promise identifier within this item/seller context. + * Unique identifier of the delivery method. Required to identify which promise of the item must be updated. This value must match the `deliveryInfo.id` previously sent in a [Update product availability](https://developers.vtex.com/docs/api-reference/delivery-promise-notification-api#put-/delivery-promises/external-sellers/-sellerId-/products) request. */ id: string; /** - * Display name for the promise. + * Display name of the delivery method in the format `dd.hh:mm:ss`. */ name?: string; /** - * Time for delivery in the format `d.HH:mm:ss`. + * Estimated delivery time in `dd.hh:mm:ss` format. For example, `2.02:00:00` represents an estimated delivery time of two days and two hours. */ deliveryTime?: string; }>; @@ -200,10 +200,10 @@ export type PatchDeliveryPromisesExternalSellersBySellerIdItemsByItemIdData = { itemId: string; }; query?: never; - url: '/delivery-promises/external-sellers/{sellerId}/items/{itemId}'; + url: '/api/delivery-promises/external-sellers/{sellerId}/items/{itemId}'; }; -export type PatchDeliveryPromisesExternalSellersBySellerIdItemsByItemIdErrors = { +export type PatchApiDeliveryPromisesExternalSellersBySellerIdItemsByItemIdErrors = { /** * Bad Request * @@ -228,9 +228,9 @@ export type PatchDeliveryPromisesExternalSellersBySellerIdItemsByItemIdErrors = }; }; -export type PatchDeliveryPromisesExternalSellersBySellerIdItemsByItemIdError = PatchDeliveryPromisesExternalSellersBySellerIdItemsByItemIdErrors[keyof PatchDeliveryPromisesExternalSellersBySellerIdItemsByItemIdErrors]; +export type PatchApiDeliveryPromisesExternalSellersBySellerIdItemsByItemIdError = PatchApiDeliveryPromisesExternalSellersBySellerIdItemsByItemIdErrors[keyof PatchApiDeliveryPromisesExternalSellersBySellerIdItemsByItemIdErrors]; -export type PatchDeliveryPromisesExternalSellersBySellerIdItemsByItemIdResponses = { +export type PatchApiDeliveryPromisesExternalSellersBySellerIdItemsByItemIdResponses = { /** * OK */ diff --git a/vtex/server/generated/delivery-promise-notification/zod.gen.ts b/vtex/server/generated/delivery-promise-notification/zod.gen.ts index dfc69cc8..38408d6f 100644 --- a/vtex/server/generated/delivery-promise-notification/zod.gen.ts +++ b/vtex/server/generated/delivery-promise-notification/zod.gen.ts @@ -12,8 +12,8 @@ export const zContentType = z.string().default('application/json'); */ export const zAccept = z.string().default('application/json'); -export const zPutDeliveryPromisesExternalSellersBySellerIdProductsData = z.object({ - body: z.object({ +export const zPutApiDeliveryPromisesExternalSellersBySellerIdProductsData = z.object({ + body: z.array(z.object({ itemId: z.string(), productId: z.optional(z.string()), availability: z.int(), @@ -160,7 +160,7 @@ export const zPutDeliveryPromisesExternalSellersBySellerIdProductsData = z.objec deliveryTime: z.optional(z.string()) })) })) - }), + })), path: z.object({ sellerId: z.string() }), @@ -173,12 +173,12 @@ export const zPutDeliveryPromisesExternalSellersBySellerIdProductsData = z.objec }) }); -export const zPatchDeliveryPromisesExternalSellersBySellerIdItemsByItemIdData = z.object({ +export const zPatchApiDeliveryPromisesExternalSellersBySellerIdItemsByItemIdData = z.object({ body: z.object({ availability: z.int(), promises: z.array(z.object({ availability: z.int(), - deliveryChannel: z.optional(z.string()), + deliveryChannel: z.optional(z.enum(['delivery', 'pickup-in-point'])), deliveryZoneIds: z.array(z.enum([ 'BRA_COUNTRY', 'BRA_REGION_NORTE', diff --git a/vtex/server/generated/delivery-promise-suggestions/client.gen.ts b/vtex/server/generated/delivery-promise-suggestions/client.gen.ts new file mode 100644 index 00000000..cab3c701 --- /dev/null +++ b/vtex/server/generated/delivery-promise-suggestions/client.gen.ts @@ -0,0 +1,16 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { type ClientOptions, type Config, createClient, createConfig } from './client'; +import type { ClientOptions as ClientOptions2 } from './types.gen'; + +/** + * The `createClientConfig()` function will be called on client initialization + * and the returned object will become the client's initial configuration. + * + * You may want to initialize your client this way instead of calling + * `setConfig()`. This is useful for example if you're using Next.js + * to ensure your client always has the correct values. + */ +export type CreateClientConfig = (override?: Config) => Config & T>; + +export const client = createClient(createConfig()); diff --git a/vtex/server/generated/delivery-promise-suggestions/client/client.gen.ts b/vtex/server/generated/delivery-promise-suggestions/client/client.gen.ts new file mode 100644 index 00000000..d2e55a14 --- /dev/null +++ b/vtex/server/generated/delivery-promise-suggestions/client/client.gen.ts @@ -0,0 +1,288 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { createSseClient } from '../core/serverSentEvents.gen'; +import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; +import type { Client, Config, RequestOptions, ResolvedRequestOptions } from './types.gen'; +import { + buildUrl, + createConfig, + createInterceptors, + getParseAs, + mergeConfigs, + mergeHeaders, + setAuthParams, +} from './utils.gen'; + +type ReqInit = Omit & { + body?: any; + headers: ReturnType; +}; + +export const createClient = (config: Config = {}): Client => { + let _config = mergeConfigs(createConfig(), config); + + const getConfig = (): Config => ({ ..._config }); + + const setConfig = (config: Config): Config => { + _config = mergeConfigs(_config, config); + return getConfig(); + }; + + const interceptors = createInterceptors(); + + const beforeRequest = async (options: RequestOptions) => { + const opts = { + ..._config, + ...options, + fetch: options.fetch ?? _config.fetch ?? globalThis.fetch, + headers: mergeHeaders(_config.headers, options.headers), + serializedBody: undefined, + }; + + if (opts.security) { + await setAuthParams({ + ...opts, + security: opts.security, + }); + } + + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + + if (opts.body !== undefined && opts.bodySerializer) { + opts.serializedBody = opts.bodySerializer(opts.body); + } + + // remove Content-Type header if body is empty to avoid sending invalid requests + if (opts.body === undefined || opts.serializedBody === '') { + opts.headers.delete('Content-Type'); + } + + const url = buildUrl(opts); + + return { opts, url }; + }; + + const request: Client['request'] = async (options) => { + // @ts-expect-error + const { opts, url } = await beforeRequest(options); + const requestInit: ReqInit = { + redirect: 'follow', + ...opts, + body: getValidRequestBody(opts), + }; + + let request = new Request(url, requestInit); + + for (const fn of interceptors.request.fns) { + if (fn) { + request = await fn(request, opts); + } + } + + // fetch must be assigned here, otherwise it would throw the error: + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation + const _fetch = opts.fetch!; + let response: Response; + + try { + response = await _fetch(request); + } catch (error) { + // Handle fetch exceptions (AbortError, network errors, etc.) + let finalError = error; + + for (const fn of interceptors.error.fns) { + if (fn) { + finalError = (await fn(error, undefined as any, request, opts)) as unknown; + } + } + + finalError = finalError || ({} as unknown); + + if (opts.throwOnError) { + throw finalError; + } + + // Return error response + return opts.responseStyle === 'data' + ? undefined + : { + error: finalError, + request, + response: undefined as any, + }; + } + + for (const fn of interceptors.response.fns) { + if (fn) { + response = await fn(response, request, opts); + } + } + + const result = { + request, + response, + }; + + if (response.ok) { + const parseAs = + (opts.parseAs === 'auto' + ? getParseAs(response.headers.get('Content-Type')) + : opts.parseAs) ?? 'json'; + + if (response.status === 204 || response.headers.get('Content-Length') === '0') { + let emptyData: any; + switch (parseAs) { + case 'arrayBuffer': + case 'blob': + case 'text': + emptyData = await response[parseAs](); + break; + case 'formData': + emptyData = new FormData(); + break; + case 'stream': + emptyData = response.body; + break; + case 'json': + default: + emptyData = {}; + break; + } + return opts.responseStyle === 'data' + ? emptyData + : { + data: emptyData, + ...result, + }; + } + + let data: any; + switch (parseAs) { + case 'arrayBuffer': + case 'blob': + case 'formData': + case 'text': + data = await response[parseAs](); + break; + case 'json': { + // Some servers return 200 with no Content-Length and empty body. + // response.json() would throw; read as text and parse if non-empty. + const text = await response.text(); + data = text ? JSON.parse(text) : {}; + break; + } + case 'stream': + return opts.responseStyle === 'data' + ? response.body + : { + data: response.body, + ...result, + }; + } + + if (parseAs === 'json') { + if (opts.responseValidator) { + await opts.responseValidator(data); + } + + if (opts.responseTransformer) { + data = await opts.responseTransformer(data); + } + } + + return opts.responseStyle === 'data' + ? data + : { + data, + ...result, + }; + } + + const textError = await response.text(); + let jsonError: unknown; + + try { + jsonError = JSON.parse(textError); + } catch { + // noop + } + + const error = jsonError ?? textError; + let finalError = error; + + for (const fn of interceptors.error.fns) { + if (fn) { + finalError = (await fn(error, response, request, opts)) as string; + } + } + + finalError = finalError || ({} as string); + + if (opts.throwOnError) { + throw finalError; + } + + // TODO: we probably want to return error and improve types + return opts.responseStyle === 'data' + ? undefined + : { + error: finalError, + ...result, + }; + }; + + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => + request({ ...options, method }); + + const makeSseFn = (method: Uppercase) => async (options: RequestOptions) => { + const { opts, url } = await beforeRequest(options); + return createSseClient({ + ...opts, + body: opts.body as BodyInit | null | undefined, + headers: opts.headers as unknown as Record, + method, + onRequest: async (url, init) => { + let request = new Request(url, init); + for (const fn of interceptors.request.fns) { + if (fn) { + request = await fn(request, opts); + } + } + return request; + }, + serializedBody: getValidRequestBody(opts) as BodyInit | null | undefined, + url, + }); + }; + + return { + buildUrl, + connect: makeMethodFn('CONNECT'), + delete: makeMethodFn('DELETE'), + get: makeMethodFn('GET'), + getConfig, + head: makeMethodFn('HEAD'), + interceptors, + options: makeMethodFn('OPTIONS'), + patch: makeMethodFn('PATCH'), + post: makeMethodFn('POST'), + put: makeMethodFn('PUT'), + request, + setConfig, + sse: { + connect: makeSseFn('CONNECT'), + delete: makeSseFn('DELETE'), + get: makeSseFn('GET'), + head: makeSseFn('HEAD'), + options: makeSseFn('OPTIONS'), + patch: makeSseFn('PATCH'), + post: makeSseFn('POST'), + put: makeSseFn('PUT'), + trace: makeSseFn('TRACE'), + }, + trace: makeMethodFn('TRACE'), + } as Client; +}; diff --git a/vtex/server/generated/delivery-promise-suggestions/client/index.ts b/vtex/server/generated/delivery-promise-suggestions/client/index.ts new file mode 100644 index 00000000..b295edec --- /dev/null +++ b/vtex/server/generated/delivery-promise-suggestions/client/index.ts @@ -0,0 +1,25 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type { Auth } from '../core/auth.gen'; +export type { QuerySerializerOptions } from '../core/bodySerializer.gen'; +export { + formDataBodySerializer, + jsonBodySerializer, + urlSearchParamsBodySerializer, +} from '../core/bodySerializer.gen'; +export { buildClientParams } from '../core/params.gen'; +export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen'; +export { createClient } from './client.gen'; +export type { + Client, + ClientOptions, + Config, + CreateClientConfig, + Options, + RequestOptions, + RequestResult, + ResolvedRequestOptions, + ResponseStyle, + TDataShape, +} from './types.gen'; +export { createConfig, mergeHeaders } from './utils.gen'; diff --git a/vtex/server/generated/delivery-promise-suggestions/client/types.gen.ts b/vtex/server/generated/delivery-promise-suggestions/client/types.gen.ts new file mode 100644 index 00000000..cb6d0d54 --- /dev/null +++ b/vtex/server/generated/delivery-promise-suggestions/client/types.gen.ts @@ -0,0 +1,213 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Auth } from '../core/auth.gen'; +import type { + ServerSentEventsOptions, + ServerSentEventsResult, +} from '../core/serverSentEvents.gen'; +import type { Client as CoreClient, Config as CoreConfig } from '../core/types.gen'; +import type { Middleware } from './utils.gen'; + +export type ResponseStyle = 'data' | 'fields'; + +export interface Config + extends Omit, CoreConfig { + /** + * Base URL for all requests made by this client. + */ + baseUrl?: T['baseUrl']; + /** + * Fetch API implementation. You can use this option to provide a custom + * fetch instance. + * + * @default globalThis.fetch + */ + fetch?: typeof fetch; + /** + * Please don't use the Fetch client for Next.js applications. The `next` + * options won't have any effect. + * + * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead. + */ + next?: never; + /** + * Return the response data parsed in a specified format. By default, `auto` + * will infer the appropriate method from the `Content-Type` response header. + * You can override this behavior with any of the {@link Body} methods. + * Select `stream` if you don't want to parse response data at all. + * + * @default 'auto' + */ + parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text'; + /** + * Should we return only data or multiple fields (data, error, response, etc.)? + * + * @default 'fields' + */ + responseStyle?: ResponseStyle; + /** + * Throw an error instead of returning it in the response? + * + * @default false + */ + throwOnError?: T['throwOnError']; +} + +export interface RequestOptions< + TData = unknown, + TResponseStyle extends ResponseStyle = 'fields', + ThrowOnError extends boolean = boolean, + Url extends string = string, +> + extends + Config<{ + responseStyle: TResponseStyle; + throwOnError: ThrowOnError; + }>, + Pick< + ServerSentEventsOptions, + | 'onSseError' + | 'onSseEvent' + | 'sseDefaultRetryDelay' + | 'sseMaxRetryAttempts' + | 'sseMaxRetryDelay' + > { + /** + * Any body that you want to add to your request. + * + * {@link https://developer.mozilla.org/docs/Web/API/fetch#body} + */ + body?: unknown; + path?: Record; + query?: Record; + /** + * Security mechanism(s) to use for the request. + */ + security?: ReadonlyArray; + url: Url; +} + +export interface ResolvedRequestOptions< + TResponseStyle extends ResponseStyle = 'fields', + ThrowOnError extends boolean = boolean, + Url extends string = string, +> extends RequestOptions { + serializedBody?: string; +} + +export type RequestResult< + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = boolean, + TResponseStyle extends ResponseStyle = 'fields', +> = ThrowOnError extends true + ? Promise< + TResponseStyle extends 'data' + ? TData extends Record + ? TData[keyof TData] + : TData + : { + data: TData extends Record ? TData[keyof TData] : TData; + request: Request; + response: Response; + } + > + : Promise< + TResponseStyle extends 'data' + ? (TData extends Record ? TData[keyof TData] : TData) | undefined + : ( + | { + data: TData extends Record ? TData[keyof TData] : TData; + error: undefined; + } + | { + data: undefined; + error: TError extends Record ? TError[keyof TError] : TError; + } + ) & { + request: Request; + response: Response; + } + >; + +export interface ClientOptions { + baseUrl?: string; + responseStyle?: ResponseStyle; + throwOnError?: boolean; +} + +type MethodFn = < + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = false, + TResponseStyle extends ResponseStyle = 'fields', +>( + options: Omit, 'method'>, +) => RequestResult; + +type SseFn = < + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = false, + TResponseStyle extends ResponseStyle = 'fields', +>( + options: Omit, 'method'>, +) => Promise>; + +type RequestFn = < + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = false, + TResponseStyle extends ResponseStyle = 'fields', +>( + options: Omit, 'method'> & + Pick>, 'method'>, +) => RequestResult; + +type BuildUrlFn = < + TData extends { + body?: unknown; + path?: Record; + query?: Record; + url: string; + }, +>( + options: TData & Options, +) => string; + +export type Client = CoreClient & { + interceptors: Middleware; +}; + +/** + * The `createClientConfig()` function will be called on client initialization + * and the returned object will become the client's initial configuration. + * + * You may want to initialize your client this way instead of calling + * `setConfig()`. This is useful for example if you're using Next.js + * to ensure your client always has the correct values. + */ +export type CreateClientConfig = ( + override?: Config, +) => Config & T>; + +export interface TDataShape { + body?: unknown; + headers?: unknown; + path?: unknown; + query?: unknown; + url: string; +} + +type OmitKeys = Pick>; + +export type Options< + TData extends TDataShape = TDataShape, + ThrowOnError extends boolean = boolean, + TResponse = unknown, + TResponseStyle extends ResponseStyle = 'fields', +> = OmitKeys< + RequestOptions, + 'body' | 'path' | 'query' | 'url' +> & + ([TData] extends [never] ? unknown : Omit); diff --git a/vtex/server/generated/delivery-promise-suggestions/client/utils.gen.ts b/vtex/server/generated/delivery-promise-suggestions/client/utils.gen.ts new file mode 100644 index 00000000..b4bd2435 --- /dev/null +++ b/vtex/server/generated/delivery-promise-suggestions/client/utils.gen.ts @@ -0,0 +1,316 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { getAuthToken } from '../core/auth.gen'; +import type { QuerySerializerOptions } from '../core/bodySerializer.gen'; +import { jsonBodySerializer } from '../core/bodySerializer.gen'; +import { + serializeArrayParam, + serializeObjectParam, + serializePrimitiveParam, +} from '../core/pathSerializer.gen'; +import { getUrl } from '../core/utils.gen'; +import type { Client, ClientOptions, Config, RequestOptions } from './types.gen'; + +export const createQuerySerializer = ({ + parameters = {}, + ...args +}: QuerySerializerOptions = {}) => { + const querySerializer = (queryParams: T) => { + const search: string[] = []; + if (queryParams && typeof queryParams === 'object') { + for (const name in queryParams) { + const value = queryParams[name]; + + if (value === undefined || value === null) { + continue; + } + + const options = parameters[name] || args; + + if (Array.isArray(value)) { + const serializedArray = serializeArrayParam({ + allowReserved: options.allowReserved, + explode: true, + name, + style: 'form', + value, + ...options.array, + }); + if (serializedArray) search.push(serializedArray); + } else if (typeof value === 'object') { + const serializedObject = serializeObjectParam({ + allowReserved: options.allowReserved, + explode: true, + name, + style: 'deepObject', + value: value as Record, + ...options.object, + }); + if (serializedObject) search.push(serializedObject); + } else { + const serializedPrimitive = serializePrimitiveParam({ + allowReserved: options.allowReserved, + name, + value: value as string, + }); + if (serializedPrimitive) search.push(serializedPrimitive); + } + } + } + return search.join('&'); + }; + return querySerializer; +}; + +/** + * Infers parseAs value from provided Content-Type header. + */ +export const getParseAs = (contentType: string | null): Exclude => { + if (!contentType) { + // If no Content-Type header is provided, the best we can do is return the raw response body, + // which is effectively the same as the 'stream' option. + return 'stream'; + } + + const cleanContent = contentType.split(';')[0]?.trim(); + + if (!cleanContent) { + return; + } + + if (cleanContent.startsWith('application/json') || cleanContent.endsWith('+json')) { + return 'json'; + } + + if (cleanContent === 'multipart/form-data') { + return 'formData'; + } + + if ( + ['application/', 'audio/', 'image/', 'video/'].some((type) => cleanContent.startsWith(type)) + ) { + return 'blob'; + } + + if (cleanContent.startsWith('text/')) { + return 'text'; + } + + return; +}; + +const checkForExistence = ( + options: Pick & { + headers: Headers; + }, + name?: string, +): boolean => { + if (!name) { + return false; + } + if ( + options.headers.has(name) || + options.query?.[name] || + options.headers.get('Cookie')?.includes(`${name}=`) + ) { + return true; + } + return false; +}; + +export const setAuthParams = async ({ + security, + ...options +}: Pick, 'security'> & + Pick & { + headers: Headers; + }) => { + for (const auth of security) { + if (checkForExistence(options, auth.name)) { + continue; + } + + const token = await getAuthToken(auth, options.auth); + + if (!token) { + continue; + } + + const name = auth.name ?? 'Authorization'; + + switch (auth.in) { + case 'query': + if (!options.query) { + options.query = {}; + } + options.query[name] = token; + break; + case 'cookie': + options.headers.append('Cookie', `${name}=${token}`); + break; + case 'header': + default: + options.headers.set(name, token); + break; + } + } +}; + +export const buildUrl: Client['buildUrl'] = (options) => + getUrl({ + baseUrl: options.baseUrl as string, + path: options.path, + query: options.query, + querySerializer: + typeof options.querySerializer === 'function' + ? options.querySerializer + : createQuerySerializer(options.querySerializer), + url: options.url, + }); + +export const mergeConfigs = (a: Config, b: Config): Config => { + const config = { ...a, ...b }; + if (config.baseUrl?.endsWith('/')) { + config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1); + } + config.headers = mergeHeaders(a.headers, b.headers); + return config; +}; + +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + +export const mergeHeaders = ( + ...headers: Array['headers'] | undefined> +): Headers => { + const mergedHeaders = new Headers(); + for (const header of headers) { + if (!header) { + continue; + } + + const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header); + + for (const [key, value] of iterator) { + if (value === null) { + mergedHeaders.delete(key); + } else if (Array.isArray(value)) { + for (const v of value) { + mergedHeaders.append(key, v as string); + } + } else if (value !== undefined) { + // assume object headers are meant to be JSON stringified, i.e. their + // content value in OpenAPI specification is 'application/json' + mergedHeaders.set( + key, + typeof value === 'object' ? JSON.stringify(value) : (value as string), + ); + } + } + } + return mergedHeaders; +}; + +type ErrInterceptor = ( + error: Err, + response: Res, + request: Req, + options: Options, +) => Err | Promise; + +type ReqInterceptor = (request: Req, options: Options) => Req | Promise; + +type ResInterceptor = ( + response: Res, + request: Req, + options: Options, +) => Res | Promise; + +class Interceptors { + fns: Array = []; + + clear(): void { + this.fns = []; + } + + eject(id: number | Interceptor): void { + const index = this.getInterceptorIndex(id); + if (this.fns[index]) { + this.fns[index] = null; + } + } + + exists(id: number | Interceptor): boolean { + const index = this.getInterceptorIndex(id); + return Boolean(this.fns[index]); + } + + getInterceptorIndex(id: number | Interceptor): number { + if (typeof id === 'number') { + return this.fns[id] ? id : -1; + } + return this.fns.indexOf(id); + } + + update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false { + const index = this.getInterceptorIndex(id); + if (this.fns[index]) { + this.fns[index] = fn; + return id; + } + return false; + } + + use(fn: Interceptor): number { + this.fns.push(fn); + return this.fns.length - 1; + } +} + +export interface Middleware { + error: Interceptors>; + request: Interceptors>; + response: Interceptors>; +} + +export const createInterceptors = (): Middleware< + Req, + Res, + Err, + Options +> => ({ + error: new Interceptors>(), + request: new Interceptors>(), + response: new Interceptors>(), +}); + +const defaultQuerySerializer = createQuerySerializer({ + allowReserved: false, + array: { + explode: true, + style: 'form', + }, + object: { + explode: true, + style: 'deepObject', + }, +}); + +const defaultHeaders = { + 'Content-Type': 'application/json', +}; + +export const createConfig = ( + override: Config & T> = {}, +): Config & T> => ({ + ...jsonBodySerializer, + headers: defaultHeaders, + parseAs: 'auto', + querySerializer: defaultQuerySerializer, + ...override, +}); diff --git a/vtex/server/generated/delivery-promise-suggestions/core/auth.gen.ts b/vtex/server/generated/delivery-promise-suggestions/core/auth.gen.ts new file mode 100644 index 00000000..3ebf9947 --- /dev/null +++ b/vtex/server/generated/delivery-promise-suggestions/core/auth.gen.ts @@ -0,0 +1,41 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type AuthToken = string | undefined; + +export interface Auth { + /** + * Which part of the request do we use to send the auth? + * + * @default 'header' + */ + in?: 'header' | 'query' | 'cookie'; + /** + * Header or query parameter name. + * + * @default 'Authorization' + */ + name?: string; + scheme?: 'basic' | 'bearer'; + type: 'apiKey' | 'http'; +} + +export const getAuthToken = async ( + auth: Auth, + callback: ((auth: Auth) => Promise | AuthToken) | AuthToken, +): Promise => { + const token = typeof callback === 'function' ? await callback(auth) : callback; + + if (!token) { + return; + } + + if (auth.scheme === 'bearer') { + return `Bearer ${token}`; + } + + if (auth.scheme === 'basic') { + return `Basic ${btoa(token)}`; + } + + return token; +}; diff --git a/vtex/server/generated/delivery-promise-suggestions/core/bodySerializer.gen.ts b/vtex/server/generated/delivery-promise-suggestions/core/bodySerializer.gen.ts new file mode 100644 index 00000000..8ad92c9f --- /dev/null +++ b/vtex/server/generated/delivery-promise-suggestions/core/bodySerializer.gen.ts @@ -0,0 +1,84 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { ArrayStyle, ObjectStyle, SerializerOptions } from './pathSerializer.gen'; + +export type QuerySerializer = (query: Record) => string; + +export type BodySerializer = (body: any) => any; + +type QuerySerializerOptionsObject = { + allowReserved?: boolean; + array?: Partial>; + object?: Partial>; +}; + +export type QuerySerializerOptions = QuerySerializerOptionsObject & { + /** + * Per-parameter serialization overrides. When provided, these settings + * override the global array/object settings for specific parameter names. + */ + parameters?: Record; +}; + +const serializeFormDataPair = (data: FormData, key: string, value: unknown): void => { + if (typeof value === 'string' || value instanceof Blob) { + data.append(key, value); + } else if (value instanceof Date) { + data.append(key, value.toISOString()); + } else { + data.append(key, JSON.stringify(value)); + } +}; + +const serializeUrlSearchParamsPair = (data: URLSearchParams, key: string, value: unknown): void => { + if (typeof value === 'string') { + data.append(key, value); + } else { + data.append(key, JSON.stringify(value)); + } +}; + +export const formDataBodySerializer = { + bodySerializer: | Array>>( + body: T, + ): FormData => { + const data = new FormData(); + + Object.entries(body).forEach(([key, value]) => { + if (value === undefined || value === null) { + return; + } + if (Array.isArray(value)) { + value.forEach((v) => serializeFormDataPair(data, key, v)); + } else { + serializeFormDataPair(data, key, value); + } + }); + + return data; + }, +}; + +export const jsonBodySerializer = { + bodySerializer: (body: T): string => + JSON.stringify(body, (_key, value) => (typeof value === 'bigint' ? value.toString() : value)), +}; + +export const urlSearchParamsBodySerializer = { + bodySerializer: | Array>>(body: T): string => { + const data = new URLSearchParams(); + + Object.entries(body).forEach(([key, value]) => { + if (value === undefined || value === null) { + return; + } + if (Array.isArray(value)) { + value.forEach((v) => serializeUrlSearchParamsPair(data, key, v)); + } else { + serializeUrlSearchParamsPair(data, key, value); + } + }); + + return data.toString(); + }, +}; diff --git a/vtex/server/generated/delivery-promise-suggestions/core/params.gen.ts b/vtex/server/generated/delivery-promise-suggestions/core/params.gen.ts new file mode 100644 index 00000000..6099cab1 --- /dev/null +++ b/vtex/server/generated/delivery-promise-suggestions/core/params.gen.ts @@ -0,0 +1,169 @@ +// This file is auto-generated by @hey-api/openapi-ts + +type Slot = 'body' | 'headers' | 'path' | 'query'; + +export type Field = + | { + in: Exclude; + /** + * Field name. This is the name we want the user to see and use. + */ + key: string; + /** + * Field mapped name. This is the name we want to use in the request. + * If omitted, we use the same value as `key`. + */ + map?: string; + } + | { + in: Extract; + /** + * Key isn't required for bodies. + */ + key?: string; + map?: string; + } + | { + /** + * Field name. This is the name we want the user to see and use. + */ + key: string; + /** + * Field mapped name. This is the name we want to use in the request. + * If `in` is omitted, `map` aliases `key` to the transport layer. + */ + map: Slot; + }; + +export interface Fields { + allowExtra?: Partial>; + args?: ReadonlyArray; +} + +export type FieldsConfig = ReadonlyArray; + +const extraPrefixesMap: Record = { + $body_: 'body', + $headers_: 'headers', + $path_: 'path', + $query_: 'query', +}; +const extraPrefixes = Object.entries(extraPrefixesMap); + +type KeyMap = Map< + string, + | { + in: Slot; + map?: string; + } + | { + in?: never; + map: Slot; + } +>; + +const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { + if (!map) { + map = new Map(); + } + + for (const config of fields) { + if ('in' in config) { + if (config.key) { + map.set(config.key, { + in: config.in, + map: config.map, + }); + } + } else if ('key' in config) { + map.set(config.key, { + map: config.map, + }); + } else if (config.args) { + buildKeyMap(config.args, map); + } + } + + return map; +}; + +interface Params { + body: unknown; + headers: Record; + path: Record; + query: Record; +} + +const stripEmptySlots = (params: Params) => { + for (const [slot, value] of Object.entries(params)) { + if (value && typeof value === 'object' && !Object.keys(value).length) { + delete params[slot as Slot]; + } + } +}; + +export const buildClientParams = (args: ReadonlyArray, fields: FieldsConfig) => { + const params: Params = { + body: {}, + headers: {}, + path: {}, + query: {}, + }; + + const map = buildKeyMap(fields); + + let config: FieldsConfig[number] | undefined; + + for (const [index, arg] of args.entries()) { + if (fields[index]) { + config = fields[index]; + } + + if (!config) { + continue; + } + + if ('in' in config) { + if (config.key) { + const field = map.get(config.key)!; + const name = field.map || config.key; + if (field.in) { + (params[field.in] as Record)[name] = arg; + } + } else { + params.body = arg; + } + } else { + for (const [key, value] of Object.entries(arg ?? {})) { + const field = map.get(key); + + if (field) { + if (field.in) { + const name = field.map || key; + (params[field.in] as Record)[name] = value; + } else { + params[field.map] = value; + } + } else { + const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix)); + + if (extra) { + const [prefix, slot] = extra; + (params[slot] as Record)[key.slice(prefix.length)] = value; + } else if ('allowExtra' in config && config.allowExtra) { + for (const [slot, allowed] of Object.entries(config.allowExtra)) { + if (allowed) { + (params[slot as Slot] as Record)[key] = value; + break; + } + } + } + } + } + } + } + + stripEmptySlots(params); + + return params; +}; diff --git a/vtex/server/generated/delivery-promise-suggestions/core/pathSerializer.gen.ts b/vtex/server/generated/delivery-promise-suggestions/core/pathSerializer.gen.ts new file mode 100644 index 00000000..994b2848 --- /dev/null +++ b/vtex/server/generated/delivery-promise-suggestions/core/pathSerializer.gen.ts @@ -0,0 +1,171 @@ +// This file is auto-generated by @hey-api/openapi-ts + +interface SerializeOptions extends SerializePrimitiveOptions, SerializerOptions {} + +interface SerializePrimitiveOptions { + allowReserved?: boolean; + name: string; +} + +export interface SerializerOptions { + /** + * @default true + */ + explode: boolean; + style: T; +} + +export type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited'; +export type ArraySeparatorStyle = ArrayStyle | MatrixStyle; +type MatrixStyle = 'label' | 'matrix' | 'simple'; +export type ObjectStyle = 'form' | 'deepObject'; +type ObjectSeparatorStyle = ObjectStyle | MatrixStyle; + +interface SerializePrimitiveParam extends SerializePrimitiveOptions { + value: string; +} + +export const separatorArrayExplode = (style: ArraySeparatorStyle) => { + switch (style) { + case 'label': + return '.'; + case 'matrix': + return ';'; + case 'simple': + return ','; + default: + return '&'; + } +}; + +export const separatorArrayNoExplode = (style: ArraySeparatorStyle) => { + switch (style) { + case 'form': + return ','; + case 'pipeDelimited': + return '|'; + case 'spaceDelimited': + return '%20'; + default: + return ','; + } +}; + +export const separatorObjectExplode = (style: ObjectSeparatorStyle) => { + switch (style) { + case 'label': + return '.'; + case 'matrix': + return ';'; + case 'simple': + return ','; + default: + return '&'; + } +}; + +export const serializeArrayParam = ({ + allowReserved, + explode, + name, + style, + value, +}: SerializeOptions & { + value: unknown[]; +}) => { + if (!explode) { + const joinedValues = ( + allowReserved ? value : value.map((v) => encodeURIComponent(v as string)) + ).join(separatorArrayNoExplode(style)); + switch (style) { + case 'label': + return `.${joinedValues}`; + case 'matrix': + return `;${name}=${joinedValues}`; + case 'simple': + return joinedValues; + default: + return `${name}=${joinedValues}`; + } + } + + const separator = separatorArrayExplode(style); + const joinedValues = value + .map((v) => { + if (style === 'label' || style === 'simple') { + return allowReserved ? v : encodeURIComponent(v as string); + } + + return serializePrimitiveParam({ + allowReserved, + name, + value: v as string, + }); + }) + .join(separator); + return style === 'label' || style === 'matrix' ? separator + joinedValues : joinedValues; +}; + +export const serializePrimitiveParam = ({ + allowReserved, + name, + value, +}: SerializePrimitiveParam) => { + if (value === undefined || value === null) { + return ''; + } + + if (typeof value === 'object') { + throw new Error( + 'Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.', + ); + } + + return `${name}=${allowReserved ? value : encodeURIComponent(value)}`; +}; + +export const serializeObjectParam = ({ + allowReserved, + explode, + name, + style, + value, + valueOnly, +}: SerializeOptions & { + value: Record | Date; + valueOnly?: boolean; +}) => { + if (value instanceof Date) { + return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`; + } + + if (style !== 'deepObject' && !explode) { + let values: string[] = []; + Object.entries(value).forEach(([key, v]) => { + values = [...values, key, allowReserved ? (v as string) : encodeURIComponent(v as string)]; + }); + const joinedValues = values.join(','); + switch (style) { + case 'form': + return `${name}=${joinedValues}`; + case 'label': + return `.${joinedValues}`; + case 'matrix': + return `;${name}=${joinedValues}`; + default: + return joinedValues; + } + } + + const separator = separatorObjectExplode(style); + const joinedValues = Object.entries(value) + .map(([key, v]) => + serializePrimitiveParam({ + allowReserved, + name: style === 'deepObject' ? `${name}[${key}]` : key, + value: v as string, + }), + ) + .join(separator); + return style === 'label' || style === 'matrix' ? separator + joinedValues : joinedValues; +}; diff --git a/vtex/server/generated/delivery-promise-suggestions/core/queryKeySerializer.gen.ts b/vtex/server/generated/delivery-promise-suggestions/core/queryKeySerializer.gen.ts new file mode 100644 index 00000000..5000df60 --- /dev/null +++ b/vtex/server/generated/delivery-promise-suggestions/core/queryKeySerializer.gen.ts @@ -0,0 +1,117 @@ +// This file is auto-generated by @hey-api/openapi-ts + +/** + * JSON-friendly union that mirrors what Pinia Colada can hash. + */ +export type JsonValue = + | null + | string + | number + | boolean + | JsonValue[] + | { [key: string]: JsonValue }; + +/** + * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes. + */ +export const queryKeyJsonReplacer = (_key: string, value: unknown) => { + if (value === undefined || typeof value === 'function' || typeof value === 'symbol') { + return undefined; + } + if (typeof value === 'bigint') { + return value.toString(); + } + if (value instanceof Date) { + return value.toISOString(); + } + return value; +}; + +/** + * Safely stringifies a value and parses it back into a JsonValue. + */ +export const stringifyToJsonValue = (input: unknown): JsonValue | undefined => { + try { + const json = JSON.stringify(input, queryKeyJsonReplacer); + if (json === undefined) { + return undefined; + } + return JSON.parse(json) as JsonValue; + } catch { + return undefined; + } +}; + +/** + * Detects plain objects (including objects with a null prototype). + */ +const isPlainObject = (value: unknown): value is Record => { + if (value === null || typeof value !== 'object') { + return false; + } + const prototype = Object.getPrototypeOf(value as object); + return prototype === Object.prototype || prototype === null; +}; + +/** + * Turns URLSearchParams into a sorted JSON object for deterministic keys. + */ +const serializeSearchParams = (params: URLSearchParams): JsonValue => { + const entries = Array.from(params.entries()).sort(([a], [b]) => a.localeCompare(b)); + const result: Record = {}; + + for (const [key, value] of entries) { + const existing = result[key]; + if (existing === undefined) { + result[key] = value; + continue; + } + + if (Array.isArray(existing)) { + (existing as string[]).push(value); + } else { + result[key] = [existing, value]; + } + } + + return result; +}; + +/** + * Normalizes any accepted value into a JSON-friendly shape for query keys. + */ +export const serializeQueryKeyValue = (value: unknown): JsonValue | undefined => { + if (value === null) { + return null; + } + + if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { + return value; + } + + if (value === undefined || typeof value === 'function' || typeof value === 'symbol') { + return undefined; + } + + if (typeof value === 'bigint') { + return value.toString(); + } + + if (value instanceof Date) { + return value.toISOString(); + } + + if (Array.isArray(value)) { + return stringifyToJsonValue(value); + } + + if (typeof URLSearchParams !== 'undefined' && value instanceof URLSearchParams) { + return serializeSearchParams(value); + } + + if (isPlainObject(value)) { + return stringifyToJsonValue(value); + } + + return undefined; +}; diff --git a/vtex/server/generated/delivery-promise-suggestions/core/serverSentEvents.gen.ts b/vtex/server/generated/delivery-promise-suggestions/core/serverSentEvents.gen.ts new file mode 100644 index 00000000..6aa6cf02 --- /dev/null +++ b/vtex/server/generated/delivery-promise-suggestions/core/serverSentEvents.gen.ts @@ -0,0 +1,243 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Config } from './types.gen'; + +export type ServerSentEventsOptions = Omit & + Pick & { + /** + * Fetch API implementation. You can use this option to provide a custom + * fetch instance. + * + * @default globalThis.fetch + */ + fetch?: typeof fetch; + /** + * Implementing clients can call request interceptors inside this hook. + */ + onRequest?: (url: string, init: RequestInit) => Promise; + /** + * Callback invoked when a network or parsing error occurs during streaming. + * + * This option applies only if the endpoint returns a stream of events. + * + * @param error The error that occurred. + */ + onSseError?: (error: unknown) => void; + /** + * Callback invoked when an event is streamed from the server. + * + * This option applies only if the endpoint returns a stream of events. + * + * @param event Event streamed from the server. + * @returns Nothing (void). + */ + onSseEvent?: (event: StreamEvent) => void; + serializedBody?: RequestInit['body']; + /** + * Default retry delay in milliseconds. + * + * This option applies only if the endpoint returns a stream of events. + * + * @default 3000 + */ + sseDefaultRetryDelay?: number; + /** + * Maximum number of retry attempts before giving up. + */ + sseMaxRetryAttempts?: number; + /** + * Maximum retry delay in milliseconds. + * + * Applies only when exponential backoff is used. + * + * This option applies only if the endpoint returns a stream of events. + * + * @default 30000 + */ + sseMaxRetryDelay?: number; + /** + * Optional sleep function for retry backoff. + * + * Defaults to using `setTimeout`. + */ + sseSleepFn?: (ms: number) => Promise; + url: string; + }; + +export interface StreamEvent { + data: TData; + event?: string; + id?: string; + retry?: number; +} + +export type ServerSentEventsResult = { + stream: AsyncGenerator< + TData extends Record ? TData[keyof TData] : TData, + TReturn, + TNext + >; +}; + +export const createSseClient = ({ + onRequest, + onSseError, + onSseEvent, + responseTransformer, + responseValidator, + sseDefaultRetryDelay, + sseMaxRetryAttempts, + sseMaxRetryDelay, + sseSleepFn, + url, + ...options +}: ServerSentEventsOptions): ServerSentEventsResult => { + let lastEventId: string | undefined; + + const sleep = sseSleepFn ?? ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms))); + + const createStream = async function* () { + let retryDelay: number = sseDefaultRetryDelay ?? 3000; + let attempt = 0; + const signal = options.signal ?? new AbortController().signal; + + while (true) { + if (signal.aborted) break; + + attempt++; + + const headers = + options.headers instanceof Headers + ? options.headers + : new Headers(options.headers as Record | undefined); + + if (lastEventId !== undefined) { + headers.set('Last-Event-ID', lastEventId); + } + + try { + const requestInit: RequestInit = { + redirect: 'follow', + ...options, + body: options.serializedBody, + headers, + signal, + }; + let request = new Request(url, requestInit); + if (onRequest) { + request = await onRequest(url, requestInit); + } + // fetch must be assigned here, otherwise it would throw the error: + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation + const _fetch = options.fetch ?? globalThis.fetch; + const response = await _fetch(request); + + if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`); + + if (!response.body) throw new Error('No body in SSE response'); + + const reader = response.body.pipeThrough(new TextDecoderStream()).getReader(); + + let buffer = ''; + + const abortHandler = () => { + try { + reader.cancel(); + } catch { + // noop + } + }; + + signal.addEventListener('abort', abortHandler); + + try { + while (true) { + const { done, value } = await reader.read(); + if (done) break; + buffer += value; + // Normalize line endings: CRLF -> LF, then CR -> LF + buffer = buffer.replace(/\r\n/g, '\n').replace(/\r/g, '\n'); + + const chunks = buffer.split('\n\n'); + buffer = chunks.pop() ?? ''; + + for (const chunk of chunks) { + const lines = chunk.split('\n'); + const dataLines: Array = []; + let eventName: string | undefined; + + for (const line of lines) { + if (line.startsWith('data:')) { + dataLines.push(line.replace(/^data:\s*/, '')); + } else if (line.startsWith('event:')) { + eventName = line.replace(/^event:\s*/, ''); + } else if (line.startsWith('id:')) { + lastEventId = line.replace(/^id:\s*/, ''); + } else if (line.startsWith('retry:')) { + const parsed = Number.parseInt(line.replace(/^retry:\s*/, ''), 10); + if (!Number.isNaN(parsed)) { + retryDelay = parsed; + } + } + } + + let data: unknown; + let parsedJson = false; + + if (dataLines.length) { + const rawData = dataLines.join('\n'); + try { + data = JSON.parse(rawData); + parsedJson = true; + } catch { + data = rawData; + } + } + + if (parsedJson) { + if (responseValidator) { + await responseValidator(data); + } + + if (responseTransformer) { + data = await responseTransformer(data); + } + } + + onSseEvent?.({ + data, + event: eventName, + id: lastEventId, + retry: retryDelay, + }); + + if (dataLines.length) { + yield data as any; + } + } + } + } finally { + signal.removeEventListener('abort', abortHandler); + reader.releaseLock(); + } + + break; // exit loop on normal completion + } catch (error) { + // connection failed or aborted; retry after delay + onSseError?.(error); + + if (sseMaxRetryAttempts !== undefined && attempt >= sseMaxRetryAttempts) { + break; // stop after firing error + } + + // exponential backoff: double retry each attempt, cap at 30s + const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 30000); + await sleep(backoff); + } + } + }; + + const stream = createStream(); + + return { stream }; +}; diff --git a/vtex/server/generated/delivery-promise-suggestions/core/types.gen.ts b/vtex/server/generated/delivery-promise-suggestions/core/types.gen.ts new file mode 100644 index 00000000..97463257 --- /dev/null +++ b/vtex/server/generated/delivery-promise-suggestions/core/types.gen.ts @@ -0,0 +1,104 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Auth, AuthToken } from './auth.gen'; +import type { BodySerializer, QuerySerializer, QuerySerializerOptions } from './bodySerializer.gen'; + +export type HttpMethod = + | 'connect' + | 'delete' + | 'get' + | 'head' + | 'options' + | 'patch' + | 'post' + | 'put' + | 'trace'; + +export type Client< + RequestFn = never, + Config = unknown, + MethodFn = never, + BuildUrlFn = never, + SseFn = never, +> = { + /** + * Returns the final request URL. + */ + buildUrl: BuildUrlFn; + getConfig: () => Config; + request: RequestFn; + setConfig: (config: Config) => Config; +} & { + [K in HttpMethod]: MethodFn; +} & ([SseFn] extends [never] ? { sse?: never } : { sse: { [K in HttpMethod]: SseFn } }); + +export interface Config { + /** + * Auth token or a function returning auth token. The resolved value will be + * added to the request payload as defined by its `security` array. + */ + auth?: ((auth: Auth) => Promise | AuthToken) | AuthToken; + /** + * A function for serializing request body parameter. By default, + * {@link JSON.stringify()} will be used. + */ + bodySerializer?: BodySerializer | null; + /** + * An object containing any HTTP headers that you want to pre-populate your + * `Headers` object with. + * + * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more} + */ + headers?: + | RequestInit['headers'] + | Record< + string, + string | number | boolean | (string | number | boolean)[] | null | undefined | unknown + >; + /** + * The request method. + * + * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more} + */ + method?: Uppercase; + /** + * A function for serializing request query parameters. By default, arrays + * will be exploded in form style, objects will be exploded in deepObject + * style, and reserved characters are percent-encoded. + * + * This method will have no effect if the native `paramsSerializer()` Axios + * API function is used. + * + * {@link https://swagger.io/docs/specification/serialization/#query View examples} + */ + querySerializer?: QuerySerializer | QuerySerializerOptions; + /** + * A function validating request data. This is useful if you want to ensure + * the request conforms to the desired shape, so it can be safely sent to + * the server. + */ + requestValidator?: (data: unknown) => Promise; + /** + * A function transforming response data before it's returned. This is useful + * for post-processing data, e.g. converting ISO strings into Date objects. + */ + responseTransformer?: (data: unknown) => Promise; + /** + * A function validating response data. This is useful if you want to ensure + * the response conforms to the desired shape, so it can be safely passed to + * the transformers and returned to the user. + */ + responseValidator?: (data: unknown) => Promise; +} + +type IsExactlyNeverOrNeverUndefined = [T] extends [never] + ? true + : [T] extends [never | undefined] + ? [undefined] extends [T] + ? false + : true + : false; + +export type OmitNever> = { + [K in keyof T as IsExactlyNeverOrNeverUndefined extends true ? never : K]: T[K]; +}; diff --git a/vtex/server/generated/delivery-promise-suggestions/core/utils.gen.ts b/vtex/server/generated/delivery-promise-suggestions/core/utils.gen.ts new file mode 100644 index 00000000..e7ddbe35 --- /dev/null +++ b/vtex/server/generated/delivery-promise-suggestions/core/utils.gen.ts @@ -0,0 +1,140 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; +import { + type ArraySeparatorStyle, + serializeArrayParam, + serializeObjectParam, + serializePrimitiveParam, +} from './pathSerializer.gen'; + +export interface PathSerializer { + path: Record; + url: string; +} + +export const PATH_PARAM_RE = /\{[^{}]+\}/g; + +export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { + let url = _url; + const matches = _url.match(PATH_PARAM_RE); + if (matches) { + for (const match of matches) { + let explode = false; + let name = match.substring(1, match.length - 1); + let style: ArraySeparatorStyle = 'simple'; + + if (name.endsWith('*')) { + explode = true; + name = name.substring(0, name.length - 1); + } + + if (name.startsWith('.')) { + name = name.substring(1); + style = 'label'; + } else if (name.startsWith(';')) { + name = name.substring(1); + style = 'matrix'; + } + + const value = path[name]; + + if (value === undefined || value === null) { + continue; + } + + if (Array.isArray(value)) { + url = url.replace(match, serializeArrayParam({ explode, name, style, value })); + continue; + } + + if (typeof value === 'object') { + url = url.replace( + match, + serializeObjectParam({ + explode, + name, + style, + value: value as Record, + valueOnly: true, + }), + ); + continue; + } + + if (style === 'matrix') { + url = url.replace( + match, + `;${serializePrimitiveParam({ + name, + value: value as string, + })}`, + ); + continue; + } + + const replaceValue = encodeURIComponent( + style === 'label' ? `.${value as string}` : (value as string), + ); + url = url.replace(match, replaceValue); + } + } + return url; +}; + +export const getUrl = ({ + baseUrl, + path, + query, + querySerializer, + url: _url, +}: { + baseUrl?: string; + path?: Record; + query?: Record; + querySerializer: QuerySerializer; + url: string; +}) => { + const pathUrl = _url.startsWith('/') ? _url : `/${_url}`; + let url = (baseUrl ?? '') + pathUrl; + if (path) { + url = defaultPathSerializer({ path, url }); + } + let search = query ? querySerializer(query) : ''; + if (search.startsWith('?')) { + search = search.substring(1); + } + if (search) { + url += `?${search}`; + } + return url; +}; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // not all clients implement a serializedBody property (i.e. client-axios) + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/vtex/server/generated/delivery-promise-suggestions/index.ts b/vtex/server/generated/delivery-promise-suggestions/index.ts new file mode 100644 index 00000000..ecbd64b4 --- /dev/null +++ b/vtex/server/generated/delivery-promise-suggestions/index.ts @@ -0,0 +1,4 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export { getApiDeliveryPromiseSuggestions, type Options, postApiDeliveryPromiseSuggestionsSearch, postApiLogisticsShippingDeliveryZonesSearchV2, postApiLogisticsShippingPickuppointsSearch } from './sdk.gen'; +export type { Accept, ClientOptions, ContentType, DeliverySuggestionRequest, DeliverySuggestionResponse, DeliveryZonesResponse, DeliveryZonesSearchRequest, ErrorResponse, GetApiDeliveryPromiseSuggestionsData, GetApiDeliveryPromiseSuggestionsError, GetApiDeliveryPromiseSuggestionsErrors, GetApiDeliveryPromiseSuggestionsResponse, GetApiDeliveryPromiseSuggestionsResponses, PickupPointsResponse, PickupPointsSearchRequest, PostApiDeliveryPromiseSuggestionsSearchData, PostApiDeliveryPromiseSuggestionsSearchError, PostApiDeliveryPromiseSuggestionsSearchErrors, PostApiDeliveryPromiseSuggestionsSearchResponse, PostApiDeliveryPromiseSuggestionsSearchResponses, PostApiLogisticsShippingDeliveryZonesSearchV2Data, PostApiLogisticsShippingDeliveryZonesSearchV2Response, PostApiLogisticsShippingDeliveryZonesSearchV2Responses, PostApiLogisticsShippingPickuppointsSearchData, PostApiLogisticsShippingPickuppointsSearchResponse, PostApiLogisticsShippingPickuppointsSearchResponses } from './types.gen'; diff --git a/vtex/server/generated/delivery-promise-suggestions/sdk.gen.ts b/vtex/server/generated/delivery-promise-suggestions/sdk.gen.ts new file mode 100644 index 00000000..0f98eabf --- /dev/null +++ b/vtex/server/generated/delivery-promise-suggestions/sdk.gen.ts @@ -0,0 +1,157 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Client, Options as Options2, TDataShape } from './client'; +import { client } from './client.gen'; +import type { GetApiDeliveryPromiseSuggestionsData, GetApiDeliveryPromiseSuggestionsErrors, GetApiDeliveryPromiseSuggestionsResponses, PostApiDeliveryPromiseSuggestionsSearchData, PostApiDeliveryPromiseSuggestionsSearchErrors, PostApiDeliveryPromiseSuggestionsSearchResponses, PostApiLogisticsShippingDeliveryZonesSearchV2Data, PostApiLogisticsShippingDeliveryZonesSearchV2Responses, PostApiLogisticsShippingPickuppointsSearchData, PostApiLogisticsShippingPickuppointsSearchResponses } from './types.gen'; + +export type Options = Options2 & { + /** + * You can provide a client instance returned by `createClient()` instead of + * individual options. This might be also useful if you want to implement a + * custom client. + */ + client?: Client; + /** + * You can pass arbitrary values through the `meta` object. This can be + * used to access values that aren't defined as part of the SDK function. + */ + meta?: Record; +}; + +/** + * Search delivery zones + * + * Retrieves available delivery zones based on location information. This endpoint helps determine which delivery zones are applicable for a given address, using postal code, geographic coordinates, and country. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Logistics | Logistics access | **Logistics full access** | + * | Logistics | Logistics access | **Logistics shipping full access** | + * + * You can [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) with that resource or use one of the following [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--sjGDurZKJHvHJS13LnO7Dy): + * + * | **Role** | **Resource** | + * | --------------- | ----------------- | + * | Logistics - Full access | Logistics full access | + * | Logistics - Full access | Logistics shipping full access | + * + * >❗ Assigning a [predefined role](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) to users or API keys usually grants permission to multiple [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3). If some of these permissions are not necessary, consider creating a custom role instead. For more information regarding security, see [Best practices for using API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm). + * + * To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication). + */ +export const postApiLogisticsShippingDeliveryZonesSearchV2 = (options: Options) => (options.client ?? client).post({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/logistics-shipping/delivery-zones/_search/v2', + ...options +}); + +/** + * Search pickup points + * + * Retrieves available pickup points based on location information and distance constraints. This endpoint helps find pickup locations near a given address, using postal code, geographic coordinates, country, and optional maximum distance. + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Logistics | Logistics access | **Logistics full access** | + * | Logistics | Logistics access | **Logistics shipping full access** | + * + * You can [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) with that resource or use one of the following [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--sjGDurZKJHvHJS13LnO7Dy): + * + * | **Role** | **Resource** | + * | --------------- | ----------------- | + * | Logistics - Full access | Logistics full access | + * | Logistics - Full access | Logistics shipping full access | + * + * >❗ Assigning a [predefined role](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) to users or API keys usually grants permission to multiple [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3). If some of these permissions are not necessary, consider creating a custom role instead. For more information regarding security, see [Best practices for using API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm). + * + * To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication). + */ +export const postApiLogisticsShippingPickuppointsSearch = (options: Options) => (options.client ?? client).post({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/logistics-shipping/pickuppoints/_search', + ...options +}); + +/** + * Search delivery suggestions + * + * Retrieves delivery and pickup suggestions for a batch of products. The response contains suggestions for each requested product, including [available delivery and pickup options](https://help.vtex.com/docs/tutorials/delivery-options-beta#creating-delivery-options) with timing information and selection criteria tags (e.g., fastest, nearest). + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Logistics | Logistics access | **Logistics full access** | + * | Logistics | Logistics access | **Logistics shipping full access** | + * + * You can [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) with that resource or use one of the following [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--sjGDurZKJHvHJS13LnO7Dy): + * + * | **Role** | **Resource** | + * | --------------- | ----------------- | + * | Logistics - Full access | Logistics full access | + * | Logistics - Full access | Logistics shipping full access | + * + * >❗ Assigning a [predefined role](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) to users or API keys usually grants permission to multiple [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3). If some of these permissions are not necessary, consider creating a custom role instead. For more information regarding security, see [Best practices for using API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm). + * + * To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication). + */ +export const postApiDeliveryPromiseSuggestionsSearch = (options: Options) => (options.client ?? client).post({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/delivery-promise-suggestions/_search', + ...options +}); + +/** + * Get delivery suggestions + * + * Retrieves delivery and pickup suggestions for products using query parameters. This method supports caching, bookmarking, and browser optimizations. The response contains suggestions for each requested product, including [available delivery and pickup options](https://help.vtex.com/docs/tutorials/delivery-options-beta#creating-delivery-options) with timing information and selection criteria tags (e.g., fastest, nearest). + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Logistics | Logistics access | **Logistics viewer** | + * + * You can [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) with that resource or use one of the following [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy): + * + * | **Role** | **Resource** | + * | --------------- | ----------------- | + * | Logistics - Read only | Logistics viewer | + * + * >❗ Assigning a [predefined role](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) to users or API keys usually grants permission to multiple [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3). If some of these permissions are not necessary, consider creating a custom role instead. For more information regarding security, see [Best practices for using API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm). + * + * To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication). + */ +export const getApiDeliveryPromiseSuggestions = (options: Options) => (options.client ?? client).get({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/delivery-promise-suggestions', + ...options +}); diff --git a/vtex/server/generated/delivery-promise-suggestions/types.gen.ts b/vtex/server/generated/delivery-promise-suggestions/types.gen.ts new file mode 100644 index 00000000..cc4a2951 --- /dev/null +++ b/vtex/server/generated/delivery-promise-suggestions/types.gen.ts @@ -0,0 +1,448 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type ClientOptions = { + baseUrl: 'https://{accountName}.{environment}.com.br' | (string & {}); +}; + +/** + * Request body for delivery zones search queries. + */ +export type DeliveryZonesSearchRequest = { + /** + * Postal code of the location. + */ + zipCode: string; + /** + * Geographic coordinates in the format "longitude,latitude". + */ + geoCoordinates?: string; + /** + * Three-letter country code (ISO 3166-1 alpha-3). + */ + country: string; +}; + +/** + * Request body for location-based search queries. + */ +export type PickupPointsSearchRequest = { + /** + * Postal code of the location. + */ + zipCode: string; + /** + * Geographic coordinates. + */ + coordinate: { + /** + * Latitude of the location. + */ + latitude?: number; + /** + * Longitude of the location. + */ + longitude?: number; + }; + /** + * Three-letter country code (ISO 3166-1 alpha-3). + */ + country: string; +}; + +/** + * Response containing available delivery zones for the specified location. + */ +export type DeliveryZonesResponse = { + /** + * Array of delivery zones available for the location. + */ + deliveryZonesIds?: Array; + /** + * Hash representing the delivery zones context. This hash is required in the [Get delivery suggestions](https://developers.vtex.com/docs/api-reference/delivery-promise-suggestionss-api#get-/api/delivery-promise-suggestions) and the [Search delivery suggestions](https://developers.vtex.com/docs/api-reference/delivery-promise-suggestionss-api#post-/api/delivery-promise-suggestions/_search) endpoints. + */ + deliveryZonesHash?: string; + /** + * Three-letter country code (ISO 3166-1 alpha-3). + */ + countryCode?: string; +}; + +/** + * Response containing available pickup points for the specified location. + */ +export type PickupPointsResponse = { + /** + * Array of pickup points available near the location. + */ + pickupPointDistances?: Array<{ + /** + * Unique identifier of the pickup point. + */ + pickupId?: string; + /** + * Human-readable name of the pickup point. + */ + pickupName?: string; + /** + * Distance from the searched location in kilometers. + */ + distance?: number; + /** + * Indicates if the pickup point is active. + */ + isActive?: boolean; + /** + * Physical address of the pickup point. + */ + address?: { + /** + * Street name. + */ + street?: string; + /** + * Street number. + */ + number?: string; + /** + * Postal code. + */ + postalCode?: string; + /** + * City name. + */ + city?: string; + /** + * State or province code. + */ + state?: string; + /** + * Neighborhood name. + */ + neighborhood?: string; + }; + /** + * Business hours of the pickup point from Monday to Friday. + */ + businessHours?: Array<{ + /** + * Day of the week identification, as in `0` = Sunday, `1` = Monday, `2` = Tuesday, `3` = Wednesday, `4` = Thursday, `5` = Friday, and `6` = Saturday. + */ + dayOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6; + /** + * Opening time of the pickup point in `HH:MM:SS` format. + */ + openingTime?: string; + /** + * Closing time of the pickup point in `HH:MM:SS` format. + */ + closingTime?: string; + }>; + }>; + /** + * Hash representing the pickup points context. This hash is required and used in the `pickupsHash` field of the [Get delivery suggestions](https://developers.vtex.com/docs/api-reference/delivery-promise-suggestionss-api#get-/api/delivery-promise-suggestions) and the [Search delivery suggestions](https://developers.vtex.com/docs/api-reference/delivery-promise-suggestionss-api#post-/api/delivery-promise-suggestions/_search) endpoints. + */ + pickupPointsHash?: string; +}; + +/** + * Request body for delivery suggestion queries. + */ +export type DeliverySuggestionRequest = { + /** + * Array of products to get delivery suggestions for. Must contain between 1 and 20 products. + */ + products: Array<{ + /** + * The unique identifier of the product. + */ + productId: string; + /** + * The specific SKU ID. If omitted, all SKUs for the product are evaluated. + */ + itemId?: string; + }>; + /** + * Hash representing the user's delivery context, which is a part of the fulfillment context. This hash is generated by the [Search delivery zones](https://developers.vtex.com/docs/api-reference/delivery-promise-suggestionss-api#post-/api/logistics-shipping/delivery-zones/_search/v2) endpoint. + */ + deliveryZonesHash: string; + /** + * Hash representing the user's pickup context, which is a part of the fulfillment context. This hash is generated by the [Search pickup points](https://developers.vtex.com/docs/api-reference/delivery-promise-suggestionss-api#post-/api/logistics-shipping/pickuppoints/_search) endpoint. + */ + pickupsHash: string; +}; + +/** + * Response containing delivery suggestions for requested products. + */ +export type DeliverySuggestionResponse = { + /** + * Array of delivery suggestions, with one entry corresponding to each product in the request. + */ + suggestions?: Array<{ + /** + * The unique identifier of the product. + */ + productId: string; + /** + * Object containing delivery and pickup options suggestions. + */ + suggestions: { + /** + * Array of delivery option suggestions. An empty array indicates no delivery options are available for the current context. + */ + delivery: Array<{ + /** + * The unique identifier for the specific delivery option (SLA). + */ + id?: string; + /** + * A human-readable name for the delivery option (e.g., "Express Delivery"). + */ + name?: string; + /** + * Object defining the time window for fulfillment. + */ + slaTimeTarget?: { + /** + * Minimum time for fulfillment. + */ + from?: number; + /** + * Maximum time for fulfillment. + */ + to?: number; + /** + * Time unit: `h` for hours or `d` for days. + */ + unit?: 'h' | 'd'; + }; + /** + * Tags indicating why the option was selected (e.g., `fastest`, `nearest`). + */ + conditions?: Array; + }>; + /** + * Array of pickup option suggestions. An empty array indicates no pickup options are available for the current context. + */ + pickup: Array<{ + /** + * The unique identifier for the specific pickup option (Store). + */ + id?: string; + /** + * A human-readable name for the pickup option (e.g., "Downtown Store"). + */ + name?: string; + /** + * Object defining the time window for fulfillment. + */ + slaTimeTarget?: { + /** + * Minimum time for fulfillment. + */ + from?: number; + /** + * Maximum time for fulfillment. + */ + to?: number; + /** + * Time unit: `h` for hours or `d` for days. + */ + unit?: 'h' | 'd'; + }; + /** + * Tags indicating why the option was selected (e.g., `fastest`, `nearest`). + */ + conditions?: Array; + }>; + }; + }>; +}; + +/** + * Error response structure. + */ +export type ErrorResponse = { + /** + * Descriptive message of the error. + */ + message: string; +}; + +/** + * Type of the content being sent. + */ +export type ContentType = string; + +/** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ +export type Accept = string; + +export type PostApiLogisticsShippingDeliveryZonesSearchV2Data = { + body: DeliveryZonesSearchRequest; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path?: never; + query?: never; + url: '/api/logistics-shipping/delivery-zones/_search/v2'; +}; + +export type PostApiLogisticsShippingDeliveryZonesSearchV2Responses = { + /** + * OK + */ + 200: DeliveryZonesResponse; +}; + +export type PostApiLogisticsShippingDeliveryZonesSearchV2Response = PostApiLogisticsShippingDeliveryZonesSearchV2Responses[keyof PostApiLogisticsShippingDeliveryZonesSearchV2Responses]; + +export type PostApiLogisticsShippingPickuppointsSearchData = { + body: PickupPointsSearchRequest; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path?: never; + query?: { + /** + * Maximum distance in kilometers from the specified location to search for pickup points. + */ + maxDistance?: number; + }; + url: '/api/logistics-shipping/pickuppoints/_search'; +}; + +export type PostApiLogisticsShippingPickuppointsSearchResponses = { + /** + * OK + */ + 200: PickupPointsResponse; +}; + +export type PostApiLogisticsShippingPickuppointsSearchResponse = PostApiLogisticsShippingPickuppointsSearchResponses[keyof PostApiLogisticsShippingPickuppointsSearchResponses]; + +export type PostApiDeliveryPromiseSuggestionsSearchData = { + body: DeliverySuggestionRequest; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path?: never; + query?: never; + url: '/api/delivery-promise-suggestions/_search'; +}; + +export type PostApiDeliveryPromiseSuggestionsSearchErrors = { + /** + * Bad Request + */ + 400: ErrorResponse; + /** + * Unauthorized + */ + 401: ErrorResponse; + /** + * Forbidden + */ + 403: ErrorResponse; + /** + * Too Many Requests + */ + 429: ErrorResponse; + /** + * Internal Server Error + */ + 500: ErrorResponse; +}; + +export type PostApiDeliveryPromiseSuggestionsSearchError = PostApiDeliveryPromiseSuggestionsSearchErrors[keyof PostApiDeliveryPromiseSuggestionsSearchErrors]; + +export type PostApiDeliveryPromiseSuggestionsSearchResponses = { + /** + * OK + */ + 200: DeliverySuggestionResponse; +}; + +export type PostApiDeliveryPromiseSuggestionsSearchResponse = PostApiDeliveryPromiseSuggestionsSearchResponses[keyof PostApiDeliveryPromiseSuggestionsSearchResponses]; + +export type GetApiDeliveryPromiseSuggestionsData = { + body?: never; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path?: never; + query: { + /** + * The unique identifier of the first product. Use index notation for multiple products (e.g., `products[0].productId`, `products[1].productId`). + */ + 'products[0].productId': string; + /** + * The specific SKU ID for the first product. If omitted, all SKUs for the product are evaluated. Use index notation for multiple SKUs (e.g., `products[0].itemId`, `products[1].itemId`). + */ + 'products[0].itemId'?: string; + /** + * Hash representing the user's delivery context, which is a part of the fulfillment context. + */ + deliveryZonesHash: string; + /** + * Hash representing the user's pickup context, which is a part of the fulfillment context. + */ + pickupsHash: string; + }; + url: '/api/delivery-promise-suggestions'; +}; + +export type GetApiDeliveryPromiseSuggestionsErrors = { + /** + * Unauthorized + */ + 401: ErrorResponse; + /** + * Too Many Requests + */ + 429: ErrorResponse; + /** + * Internal Server Error + */ + 500: ErrorResponse; +}; + +export type GetApiDeliveryPromiseSuggestionsError = GetApiDeliveryPromiseSuggestionsErrors[keyof GetApiDeliveryPromiseSuggestionsErrors]; + +export type GetApiDeliveryPromiseSuggestionsResponses = { + /** + * OK + */ + 200: DeliverySuggestionResponse; +}; + +export type GetApiDeliveryPromiseSuggestionsResponse = GetApiDeliveryPromiseSuggestionsResponses[keyof GetApiDeliveryPromiseSuggestionsResponses]; diff --git a/vtex/server/generated/delivery-promise-suggestions/zod.gen.ts b/vtex/server/generated/delivery-promise-suggestions/zod.gen.ts new file mode 100644 index 00000000..52002806 --- /dev/null +++ b/vtex/server/generated/delivery-promise-suggestions/zod.gen.ts @@ -0,0 +1,174 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import * as z from 'zod'; + +/** + * Request body for delivery zones search queries. + */ +export const zDeliveryZonesSearchRequest = z.object({ + zipCode: z.string(), + geoCoordinates: z.optional(z.string()), + country: z.string() +}); + +/** + * Request body for location-based search queries. + */ +export const zPickupPointsSearchRequest = z.object({ + zipCode: z.string(), + coordinate: z.object({ + latitude: z.optional(z.number()), + longitude: z.optional(z.number()) + }), + country: z.string() +}); + +/** + * Response containing available delivery zones for the specified location. + */ +export const zDeliveryZonesResponse = z.object({ + deliveryZonesIds: z.optional(z.array(z.string())), + deliveryZonesHash: z.optional(z.string()), + countryCode: z.optional(z.string()) +}); + +/** + * Response containing available pickup points for the specified location. + */ +export const zPickupPointsResponse = z.object({ + pickupPointDistances: z.optional(z.array(z.object({ + pickupId: z.optional(z.string()), + pickupName: z.optional(z.string()), + distance: z.optional(z.number()), + isActive: z.optional(z.boolean()), + address: z.optional(z.object({ + street: z.optional(z.string()), + number: z.optional(z.string()), + postalCode: z.optional(z.string()), + city: z.optional(z.string()), + state: z.optional(z.string()), + neighborhood: z.optional(z.string()) + })), + businessHours: z.optional(z.array(z.object({ + dayOfWeek: z.optional(z.union([ + z.literal(0), + z.literal(1), + z.literal(2), + z.literal(3), + z.literal(4), + z.literal(5), + z.literal(6) + ])), + openingTime: z.optional(z.string()), + closingTime: z.optional(z.string()) + }))) + }))), + pickupPointsHash: z.optional(z.string()) +}); + +/** + * Request body for delivery suggestion queries. + */ +export const zDeliverySuggestionRequest = z.object({ + products: z.array(z.object({ + productId: z.string(), + itemId: z.optional(z.string()) + })).min(1).max(20), + deliveryZonesHash: z.string(), + pickupsHash: z.string() +}); + +/** + * Response containing delivery suggestions for requested products. + */ +export const zDeliverySuggestionResponse = z.object({ + suggestions: z.optional(z.array(z.object({ + productId: z.string(), + suggestions: z.object({ + delivery: z.array(z.object({ + id: z.optional(z.string()), + name: z.optional(z.string()), + slaTimeTarget: z.optional(z.object({ + from: z.optional(z.number()), + to: z.optional(z.number()), + unit: z.optional(z.enum(['h', 'd'])) + })), + conditions: z.optional(z.array(z.string())) + })), + pickup: z.array(z.object({ + id: z.optional(z.string()), + name: z.optional(z.string()), + slaTimeTarget: z.optional(z.object({ + from: z.optional(z.number()), + to: z.optional(z.number()), + unit: z.optional(z.enum(['h', 'd'])) + })), + conditions: z.optional(z.array(z.string())) + })) + }) + })).min(1).max(20)) +}); + +/** + * Error response structure. + */ +export const zErrorResponse = z.object({ + message: z.string() +}); + +/** + * Type of the content being sent. + */ +export const zContentType = z.string().default('application/json'); + +/** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ +export const zAccept = z.string().default('application/json'); + +export const zPostApiLogisticsShippingDeliveryZonesSearchV2Data = z.object({ + body: zDeliveryZonesSearchRequest, + path: z.optional(z.never()), + query: z.optional(z.never()), + headers: z.object({ + 'Content-Type': z.string().default('application/json'), + Accept: z.string().default('application/json') + }) +}); + +export const zPostApiLogisticsShippingPickuppointsSearchData = z.object({ + body: zPickupPointsSearchRequest, + path: z.optional(z.never()), + query: z.optional(z.object({ + maxDistance: z.optional(z.number()) + })), + headers: z.object({ + 'Content-Type': z.string().default('application/json'), + Accept: z.string().default('application/json') + }) +}); + +export const zPostApiDeliveryPromiseSuggestionsSearchData = z.object({ + body: zDeliverySuggestionRequest, + path: z.optional(z.never()), + query: z.optional(z.never()), + headers: z.object({ + 'Content-Type': z.string().default('application/json'), + Accept: z.string().default('application/json') + }) +}); + +export const zGetApiDeliveryPromiseSuggestionsData = z.object({ + body: z.optional(z.never()), + path: z.optional(z.never()), + query: z.object({ + 'products[0].productId': z.string(), + 'products[0].itemId': z.optional(z.string()), + deliveryZonesHash: z.string(), + pickupsHash: z.string() + }), + headers: z.object({ + 'Content-Type': z.string().default('application/json'), + Accept: z.string().default('application/json') + }) +}); diff --git a/vtex/server/generated/external-promotions-protocol/client.gen.ts b/vtex/server/generated/external-promotions-protocol/client.gen.ts new file mode 100644 index 00000000..cab3c701 --- /dev/null +++ b/vtex/server/generated/external-promotions-protocol/client.gen.ts @@ -0,0 +1,16 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { type ClientOptions, type Config, createClient, createConfig } from './client'; +import type { ClientOptions as ClientOptions2 } from './types.gen'; + +/** + * The `createClientConfig()` function will be called on client initialization + * and the returned object will become the client's initial configuration. + * + * You may want to initialize your client this way instead of calling + * `setConfig()`. This is useful for example if you're using Next.js + * to ensure your client always has the correct values. + */ +export type CreateClientConfig = (override?: Config) => Config & T>; + +export const client = createClient(createConfig()); diff --git a/vtex/server/generated/external-promotions-protocol/client/client.gen.ts b/vtex/server/generated/external-promotions-protocol/client/client.gen.ts new file mode 100644 index 00000000..d2e55a14 --- /dev/null +++ b/vtex/server/generated/external-promotions-protocol/client/client.gen.ts @@ -0,0 +1,288 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { createSseClient } from '../core/serverSentEvents.gen'; +import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; +import type { Client, Config, RequestOptions, ResolvedRequestOptions } from './types.gen'; +import { + buildUrl, + createConfig, + createInterceptors, + getParseAs, + mergeConfigs, + mergeHeaders, + setAuthParams, +} from './utils.gen'; + +type ReqInit = Omit & { + body?: any; + headers: ReturnType; +}; + +export const createClient = (config: Config = {}): Client => { + let _config = mergeConfigs(createConfig(), config); + + const getConfig = (): Config => ({ ..._config }); + + const setConfig = (config: Config): Config => { + _config = mergeConfigs(_config, config); + return getConfig(); + }; + + const interceptors = createInterceptors(); + + const beforeRequest = async (options: RequestOptions) => { + const opts = { + ..._config, + ...options, + fetch: options.fetch ?? _config.fetch ?? globalThis.fetch, + headers: mergeHeaders(_config.headers, options.headers), + serializedBody: undefined, + }; + + if (opts.security) { + await setAuthParams({ + ...opts, + security: opts.security, + }); + } + + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + + if (opts.body !== undefined && opts.bodySerializer) { + opts.serializedBody = opts.bodySerializer(opts.body); + } + + // remove Content-Type header if body is empty to avoid sending invalid requests + if (opts.body === undefined || opts.serializedBody === '') { + opts.headers.delete('Content-Type'); + } + + const url = buildUrl(opts); + + return { opts, url }; + }; + + const request: Client['request'] = async (options) => { + // @ts-expect-error + const { opts, url } = await beforeRequest(options); + const requestInit: ReqInit = { + redirect: 'follow', + ...opts, + body: getValidRequestBody(opts), + }; + + let request = new Request(url, requestInit); + + for (const fn of interceptors.request.fns) { + if (fn) { + request = await fn(request, opts); + } + } + + // fetch must be assigned here, otherwise it would throw the error: + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation + const _fetch = opts.fetch!; + let response: Response; + + try { + response = await _fetch(request); + } catch (error) { + // Handle fetch exceptions (AbortError, network errors, etc.) + let finalError = error; + + for (const fn of interceptors.error.fns) { + if (fn) { + finalError = (await fn(error, undefined as any, request, opts)) as unknown; + } + } + + finalError = finalError || ({} as unknown); + + if (opts.throwOnError) { + throw finalError; + } + + // Return error response + return opts.responseStyle === 'data' + ? undefined + : { + error: finalError, + request, + response: undefined as any, + }; + } + + for (const fn of interceptors.response.fns) { + if (fn) { + response = await fn(response, request, opts); + } + } + + const result = { + request, + response, + }; + + if (response.ok) { + const parseAs = + (opts.parseAs === 'auto' + ? getParseAs(response.headers.get('Content-Type')) + : opts.parseAs) ?? 'json'; + + if (response.status === 204 || response.headers.get('Content-Length') === '0') { + let emptyData: any; + switch (parseAs) { + case 'arrayBuffer': + case 'blob': + case 'text': + emptyData = await response[parseAs](); + break; + case 'formData': + emptyData = new FormData(); + break; + case 'stream': + emptyData = response.body; + break; + case 'json': + default: + emptyData = {}; + break; + } + return opts.responseStyle === 'data' + ? emptyData + : { + data: emptyData, + ...result, + }; + } + + let data: any; + switch (parseAs) { + case 'arrayBuffer': + case 'blob': + case 'formData': + case 'text': + data = await response[parseAs](); + break; + case 'json': { + // Some servers return 200 with no Content-Length and empty body. + // response.json() would throw; read as text and parse if non-empty. + const text = await response.text(); + data = text ? JSON.parse(text) : {}; + break; + } + case 'stream': + return opts.responseStyle === 'data' + ? response.body + : { + data: response.body, + ...result, + }; + } + + if (parseAs === 'json') { + if (opts.responseValidator) { + await opts.responseValidator(data); + } + + if (opts.responseTransformer) { + data = await opts.responseTransformer(data); + } + } + + return opts.responseStyle === 'data' + ? data + : { + data, + ...result, + }; + } + + const textError = await response.text(); + let jsonError: unknown; + + try { + jsonError = JSON.parse(textError); + } catch { + // noop + } + + const error = jsonError ?? textError; + let finalError = error; + + for (const fn of interceptors.error.fns) { + if (fn) { + finalError = (await fn(error, response, request, opts)) as string; + } + } + + finalError = finalError || ({} as string); + + if (opts.throwOnError) { + throw finalError; + } + + // TODO: we probably want to return error and improve types + return opts.responseStyle === 'data' + ? undefined + : { + error: finalError, + ...result, + }; + }; + + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => + request({ ...options, method }); + + const makeSseFn = (method: Uppercase) => async (options: RequestOptions) => { + const { opts, url } = await beforeRequest(options); + return createSseClient({ + ...opts, + body: opts.body as BodyInit | null | undefined, + headers: opts.headers as unknown as Record, + method, + onRequest: async (url, init) => { + let request = new Request(url, init); + for (const fn of interceptors.request.fns) { + if (fn) { + request = await fn(request, opts); + } + } + return request; + }, + serializedBody: getValidRequestBody(opts) as BodyInit | null | undefined, + url, + }); + }; + + return { + buildUrl, + connect: makeMethodFn('CONNECT'), + delete: makeMethodFn('DELETE'), + get: makeMethodFn('GET'), + getConfig, + head: makeMethodFn('HEAD'), + interceptors, + options: makeMethodFn('OPTIONS'), + patch: makeMethodFn('PATCH'), + post: makeMethodFn('POST'), + put: makeMethodFn('PUT'), + request, + setConfig, + sse: { + connect: makeSseFn('CONNECT'), + delete: makeSseFn('DELETE'), + get: makeSseFn('GET'), + head: makeSseFn('HEAD'), + options: makeSseFn('OPTIONS'), + patch: makeSseFn('PATCH'), + post: makeSseFn('POST'), + put: makeSseFn('PUT'), + trace: makeSseFn('TRACE'), + }, + trace: makeMethodFn('TRACE'), + } as Client; +}; diff --git a/vtex/server/generated/external-promotions-protocol/client/index.ts b/vtex/server/generated/external-promotions-protocol/client/index.ts new file mode 100644 index 00000000..b295edec --- /dev/null +++ b/vtex/server/generated/external-promotions-protocol/client/index.ts @@ -0,0 +1,25 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type { Auth } from '../core/auth.gen'; +export type { QuerySerializerOptions } from '../core/bodySerializer.gen'; +export { + formDataBodySerializer, + jsonBodySerializer, + urlSearchParamsBodySerializer, +} from '../core/bodySerializer.gen'; +export { buildClientParams } from '../core/params.gen'; +export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen'; +export { createClient } from './client.gen'; +export type { + Client, + ClientOptions, + Config, + CreateClientConfig, + Options, + RequestOptions, + RequestResult, + ResolvedRequestOptions, + ResponseStyle, + TDataShape, +} from './types.gen'; +export { createConfig, mergeHeaders } from './utils.gen'; diff --git a/vtex/server/generated/external-promotions-protocol/client/types.gen.ts b/vtex/server/generated/external-promotions-protocol/client/types.gen.ts new file mode 100644 index 00000000..cb6d0d54 --- /dev/null +++ b/vtex/server/generated/external-promotions-protocol/client/types.gen.ts @@ -0,0 +1,213 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Auth } from '../core/auth.gen'; +import type { + ServerSentEventsOptions, + ServerSentEventsResult, +} from '../core/serverSentEvents.gen'; +import type { Client as CoreClient, Config as CoreConfig } from '../core/types.gen'; +import type { Middleware } from './utils.gen'; + +export type ResponseStyle = 'data' | 'fields'; + +export interface Config + extends Omit, CoreConfig { + /** + * Base URL for all requests made by this client. + */ + baseUrl?: T['baseUrl']; + /** + * Fetch API implementation. You can use this option to provide a custom + * fetch instance. + * + * @default globalThis.fetch + */ + fetch?: typeof fetch; + /** + * Please don't use the Fetch client for Next.js applications. The `next` + * options won't have any effect. + * + * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead. + */ + next?: never; + /** + * Return the response data parsed in a specified format. By default, `auto` + * will infer the appropriate method from the `Content-Type` response header. + * You can override this behavior with any of the {@link Body} methods. + * Select `stream` if you don't want to parse response data at all. + * + * @default 'auto' + */ + parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text'; + /** + * Should we return only data or multiple fields (data, error, response, etc.)? + * + * @default 'fields' + */ + responseStyle?: ResponseStyle; + /** + * Throw an error instead of returning it in the response? + * + * @default false + */ + throwOnError?: T['throwOnError']; +} + +export interface RequestOptions< + TData = unknown, + TResponseStyle extends ResponseStyle = 'fields', + ThrowOnError extends boolean = boolean, + Url extends string = string, +> + extends + Config<{ + responseStyle: TResponseStyle; + throwOnError: ThrowOnError; + }>, + Pick< + ServerSentEventsOptions, + | 'onSseError' + | 'onSseEvent' + | 'sseDefaultRetryDelay' + | 'sseMaxRetryAttempts' + | 'sseMaxRetryDelay' + > { + /** + * Any body that you want to add to your request. + * + * {@link https://developer.mozilla.org/docs/Web/API/fetch#body} + */ + body?: unknown; + path?: Record; + query?: Record; + /** + * Security mechanism(s) to use for the request. + */ + security?: ReadonlyArray; + url: Url; +} + +export interface ResolvedRequestOptions< + TResponseStyle extends ResponseStyle = 'fields', + ThrowOnError extends boolean = boolean, + Url extends string = string, +> extends RequestOptions { + serializedBody?: string; +} + +export type RequestResult< + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = boolean, + TResponseStyle extends ResponseStyle = 'fields', +> = ThrowOnError extends true + ? Promise< + TResponseStyle extends 'data' + ? TData extends Record + ? TData[keyof TData] + : TData + : { + data: TData extends Record ? TData[keyof TData] : TData; + request: Request; + response: Response; + } + > + : Promise< + TResponseStyle extends 'data' + ? (TData extends Record ? TData[keyof TData] : TData) | undefined + : ( + | { + data: TData extends Record ? TData[keyof TData] : TData; + error: undefined; + } + | { + data: undefined; + error: TError extends Record ? TError[keyof TError] : TError; + } + ) & { + request: Request; + response: Response; + } + >; + +export interface ClientOptions { + baseUrl?: string; + responseStyle?: ResponseStyle; + throwOnError?: boolean; +} + +type MethodFn = < + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = false, + TResponseStyle extends ResponseStyle = 'fields', +>( + options: Omit, 'method'>, +) => RequestResult; + +type SseFn = < + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = false, + TResponseStyle extends ResponseStyle = 'fields', +>( + options: Omit, 'method'>, +) => Promise>; + +type RequestFn = < + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = false, + TResponseStyle extends ResponseStyle = 'fields', +>( + options: Omit, 'method'> & + Pick>, 'method'>, +) => RequestResult; + +type BuildUrlFn = < + TData extends { + body?: unknown; + path?: Record; + query?: Record; + url: string; + }, +>( + options: TData & Options, +) => string; + +export type Client = CoreClient & { + interceptors: Middleware; +}; + +/** + * The `createClientConfig()` function will be called on client initialization + * and the returned object will become the client's initial configuration. + * + * You may want to initialize your client this way instead of calling + * `setConfig()`. This is useful for example if you're using Next.js + * to ensure your client always has the correct values. + */ +export type CreateClientConfig = ( + override?: Config, +) => Config & T>; + +export interface TDataShape { + body?: unknown; + headers?: unknown; + path?: unknown; + query?: unknown; + url: string; +} + +type OmitKeys = Pick>; + +export type Options< + TData extends TDataShape = TDataShape, + ThrowOnError extends boolean = boolean, + TResponse = unknown, + TResponseStyle extends ResponseStyle = 'fields', +> = OmitKeys< + RequestOptions, + 'body' | 'path' | 'query' | 'url' +> & + ([TData] extends [never] ? unknown : Omit); diff --git a/vtex/server/generated/external-promotions-protocol/client/utils.gen.ts b/vtex/server/generated/external-promotions-protocol/client/utils.gen.ts new file mode 100644 index 00000000..b4bd2435 --- /dev/null +++ b/vtex/server/generated/external-promotions-protocol/client/utils.gen.ts @@ -0,0 +1,316 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { getAuthToken } from '../core/auth.gen'; +import type { QuerySerializerOptions } from '../core/bodySerializer.gen'; +import { jsonBodySerializer } from '../core/bodySerializer.gen'; +import { + serializeArrayParam, + serializeObjectParam, + serializePrimitiveParam, +} from '../core/pathSerializer.gen'; +import { getUrl } from '../core/utils.gen'; +import type { Client, ClientOptions, Config, RequestOptions } from './types.gen'; + +export const createQuerySerializer = ({ + parameters = {}, + ...args +}: QuerySerializerOptions = {}) => { + const querySerializer = (queryParams: T) => { + const search: string[] = []; + if (queryParams && typeof queryParams === 'object') { + for (const name in queryParams) { + const value = queryParams[name]; + + if (value === undefined || value === null) { + continue; + } + + const options = parameters[name] || args; + + if (Array.isArray(value)) { + const serializedArray = serializeArrayParam({ + allowReserved: options.allowReserved, + explode: true, + name, + style: 'form', + value, + ...options.array, + }); + if (serializedArray) search.push(serializedArray); + } else if (typeof value === 'object') { + const serializedObject = serializeObjectParam({ + allowReserved: options.allowReserved, + explode: true, + name, + style: 'deepObject', + value: value as Record, + ...options.object, + }); + if (serializedObject) search.push(serializedObject); + } else { + const serializedPrimitive = serializePrimitiveParam({ + allowReserved: options.allowReserved, + name, + value: value as string, + }); + if (serializedPrimitive) search.push(serializedPrimitive); + } + } + } + return search.join('&'); + }; + return querySerializer; +}; + +/** + * Infers parseAs value from provided Content-Type header. + */ +export const getParseAs = (contentType: string | null): Exclude => { + if (!contentType) { + // If no Content-Type header is provided, the best we can do is return the raw response body, + // which is effectively the same as the 'stream' option. + return 'stream'; + } + + const cleanContent = contentType.split(';')[0]?.trim(); + + if (!cleanContent) { + return; + } + + if (cleanContent.startsWith('application/json') || cleanContent.endsWith('+json')) { + return 'json'; + } + + if (cleanContent === 'multipart/form-data') { + return 'formData'; + } + + if ( + ['application/', 'audio/', 'image/', 'video/'].some((type) => cleanContent.startsWith(type)) + ) { + return 'blob'; + } + + if (cleanContent.startsWith('text/')) { + return 'text'; + } + + return; +}; + +const checkForExistence = ( + options: Pick & { + headers: Headers; + }, + name?: string, +): boolean => { + if (!name) { + return false; + } + if ( + options.headers.has(name) || + options.query?.[name] || + options.headers.get('Cookie')?.includes(`${name}=`) + ) { + return true; + } + return false; +}; + +export const setAuthParams = async ({ + security, + ...options +}: Pick, 'security'> & + Pick & { + headers: Headers; + }) => { + for (const auth of security) { + if (checkForExistence(options, auth.name)) { + continue; + } + + const token = await getAuthToken(auth, options.auth); + + if (!token) { + continue; + } + + const name = auth.name ?? 'Authorization'; + + switch (auth.in) { + case 'query': + if (!options.query) { + options.query = {}; + } + options.query[name] = token; + break; + case 'cookie': + options.headers.append('Cookie', `${name}=${token}`); + break; + case 'header': + default: + options.headers.set(name, token); + break; + } + } +}; + +export const buildUrl: Client['buildUrl'] = (options) => + getUrl({ + baseUrl: options.baseUrl as string, + path: options.path, + query: options.query, + querySerializer: + typeof options.querySerializer === 'function' + ? options.querySerializer + : createQuerySerializer(options.querySerializer), + url: options.url, + }); + +export const mergeConfigs = (a: Config, b: Config): Config => { + const config = { ...a, ...b }; + if (config.baseUrl?.endsWith('/')) { + config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1); + } + config.headers = mergeHeaders(a.headers, b.headers); + return config; +}; + +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + +export const mergeHeaders = ( + ...headers: Array['headers'] | undefined> +): Headers => { + const mergedHeaders = new Headers(); + for (const header of headers) { + if (!header) { + continue; + } + + const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header); + + for (const [key, value] of iterator) { + if (value === null) { + mergedHeaders.delete(key); + } else if (Array.isArray(value)) { + for (const v of value) { + mergedHeaders.append(key, v as string); + } + } else if (value !== undefined) { + // assume object headers are meant to be JSON stringified, i.e. their + // content value in OpenAPI specification is 'application/json' + mergedHeaders.set( + key, + typeof value === 'object' ? JSON.stringify(value) : (value as string), + ); + } + } + } + return mergedHeaders; +}; + +type ErrInterceptor = ( + error: Err, + response: Res, + request: Req, + options: Options, +) => Err | Promise; + +type ReqInterceptor = (request: Req, options: Options) => Req | Promise; + +type ResInterceptor = ( + response: Res, + request: Req, + options: Options, +) => Res | Promise; + +class Interceptors { + fns: Array = []; + + clear(): void { + this.fns = []; + } + + eject(id: number | Interceptor): void { + const index = this.getInterceptorIndex(id); + if (this.fns[index]) { + this.fns[index] = null; + } + } + + exists(id: number | Interceptor): boolean { + const index = this.getInterceptorIndex(id); + return Boolean(this.fns[index]); + } + + getInterceptorIndex(id: number | Interceptor): number { + if (typeof id === 'number') { + return this.fns[id] ? id : -1; + } + return this.fns.indexOf(id); + } + + update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false { + const index = this.getInterceptorIndex(id); + if (this.fns[index]) { + this.fns[index] = fn; + return id; + } + return false; + } + + use(fn: Interceptor): number { + this.fns.push(fn); + return this.fns.length - 1; + } +} + +export interface Middleware { + error: Interceptors>; + request: Interceptors>; + response: Interceptors>; +} + +export const createInterceptors = (): Middleware< + Req, + Res, + Err, + Options +> => ({ + error: new Interceptors>(), + request: new Interceptors>(), + response: new Interceptors>(), +}); + +const defaultQuerySerializer = createQuerySerializer({ + allowReserved: false, + array: { + explode: true, + style: 'form', + }, + object: { + explode: true, + style: 'deepObject', + }, +}); + +const defaultHeaders = { + 'Content-Type': 'application/json', +}; + +export const createConfig = ( + override: Config & T> = {}, +): Config & T> => ({ + ...jsonBodySerializer, + headers: defaultHeaders, + parseAs: 'auto', + querySerializer: defaultQuerySerializer, + ...override, +}); diff --git a/vtex/server/generated/external-promotions-protocol/core/auth.gen.ts b/vtex/server/generated/external-promotions-protocol/core/auth.gen.ts new file mode 100644 index 00000000..3ebf9947 --- /dev/null +++ b/vtex/server/generated/external-promotions-protocol/core/auth.gen.ts @@ -0,0 +1,41 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type AuthToken = string | undefined; + +export interface Auth { + /** + * Which part of the request do we use to send the auth? + * + * @default 'header' + */ + in?: 'header' | 'query' | 'cookie'; + /** + * Header or query parameter name. + * + * @default 'Authorization' + */ + name?: string; + scheme?: 'basic' | 'bearer'; + type: 'apiKey' | 'http'; +} + +export const getAuthToken = async ( + auth: Auth, + callback: ((auth: Auth) => Promise | AuthToken) | AuthToken, +): Promise => { + const token = typeof callback === 'function' ? await callback(auth) : callback; + + if (!token) { + return; + } + + if (auth.scheme === 'bearer') { + return `Bearer ${token}`; + } + + if (auth.scheme === 'basic') { + return `Basic ${btoa(token)}`; + } + + return token; +}; diff --git a/vtex/server/generated/external-promotions-protocol/core/bodySerializer.gen.ts b/vtex/server/generated/external-promotions-protocol/core/bodySerializer.gen.ts new file mode 100644 index 00000000..8ad92c9f --- /dev/null +++ b/vtex/server/generated/external-promotions-protocol/core/bodySerializer.gen.ts @@ -0,0 +1,84 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { ArrayStyle, ObjectStyle, SerializerOptions } from './pathSerializer.gen'; + +export type QuerySerializer = (query: Record) => string; + +export type BodySerializer = (body: any) => any; + +type QuerySerializerOptionsObject = { + allowReserved?: boolean; + array?: Partial>; + object?: Partial>; +}; + +export type QuerySerializerOptions = QuerySerializerOptionsObject & { + /** + * Per-parameter serialization overrides. When provided, these settings + * override the global array/object settings for specific parameter names. + */ + parameters?: Record; +}; + +const serializeFormDataPair = (data: FormData, key: string, value: unknown): void => { + if (typeof value === 'string' || value instanceof Blob) { + data.append(key, value); + } else if (value instanceof Date) { + data.append(key, value.toISOString()); + } else { + data.append(key, JSON.stringify(value)); + } +}; + +const serializeUrlSearchParamsPair = (data: URLSearchParams, key: string, value: unknown): void => { + if (typeof value === 'string') { + data.append(key, value); + } else { + data.append(key, JSON.stringify(value)); + } +}; + +export const formDataBodySerializer = { + bodySerializer: | Array>>( + body: T, + ): FormData => { + const data = new FormData(); + + Object.entries(body).forEach(([key, value]) => { + if (value === undefined || value === null) { + return; + } + if (Array.isArray(value)) { + value.forEach((v) => serializeFormDataPair(data, key, v)); + } else { + serializeFormDataPair(data, key, value); + } + }); + + return data; + }, +}; + +export const jsonBodySerializer = { + bodySerializer: (body: T): string => + JSON.stringify(body, (_key, value) => (typeof value === 'bigint' ? value.toString() : value)), +}; + +export const urlSearchParamsBodySerializer = { + bodySerializer: | Array>>(body: T): string => { + const data = new URLSearchParams(); + + Object.entries(body).forEach(([key, value]) => { + if (value === undefined || value === null) { + return; + } + if (Array.isArray(value)) { + value.forEach((v) => serializeUrlSearchParamsPair(data, key, v)); + } else { + serializeUrlSearchParamsPair(data, key, value); + } + }); + + return data.toString(); + }, +}; diff --git a/vtex/server/generated/external-promotions-protocol/core/params.gen.ts b/vtex/server/generated/external-promotions-protocol/core/params.gen.ts new file mode 100644 index 00000000..6099cab1 --- /dev/null +++ b/vtex/server/generated/external-promotions-protocol/core/params.gen.ts @@ -0,0 +1,169 @@ +// This file is auto-generated by @hey-api/openapi-ts + +type Slot = 'body' | 'headers' | 'path' | 'query'; + +export type Field = + | { + in: Exclude; + /** + * Field name. This is the name we want the user to see and use. + */ + key: string; + /** + * Field mapped name. This is the name we want to use in the request. + * If omitted, we use the same value as `key`. + */ + map?: string; + } + | { + in: Extract; + /** + * Key isn't required for bodies. + */ + key?: string; + map?: string; + } + | { + /** + * Field name. This is the name we want the user to see and use. + */ + key: string; + /** + * Field mapped name. This is the name we want to use in the request. + * If `in` is omitted, `map` aliases `key` to the transport layer. + */ + map: Slot; + }; + +export interface Fields { + allowExtra?: Partial>; + args?: ReadonlyArray; +} + +export type FieldsConfig = ReadonlyArray; + +const extraPrefixesMap: Record = { + $body_: 'body', + $headers_: 'headers', + $path_: 'path', + $query_: 'query', +}; +const extraPrefixes = Object.entries(extraPrefixesMap); + +type KeyMap = Map< + string, + | { + in: Slot; + map?: string; + } + | { + in?: never; + map: Slot; + } +>; + +const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { + if (!map) { + map = new Map(); + } + + for (const config of fields) { + if ('in' in config) { + if (config.key) { + map.set(config.key, { + in: config.in, + map: config.map, + }); + } + } else if ('key' in config) { + map.set(config.key, { + map: config.map, + }); + } else if (config.args) { + buildKeyMap(config.args, map); + } + } + + return map; +}; + +interface Params { + body: unknown; + headers: Record; + path: Record; + query: Record; +} + +const stripEmptySlots = (params: Params) => { + for (const [slot, value] of Object.entries(params)) { + if (value && typeof value === 'object' && !Object.keys(value).length) { + delete params[slot as Slot]; + } + } +}; + +export const buildClientParams = (args: ReadonlyArray, fields: FieldsConfig) => { + const params: Params = { + body: {}, + headers: {}, + path: {}, + query: {}, + }; + + const map = buildKeyMap(fields); + + let config: FieldsConfig[number] | undefined; + + for (const [index, arg] of args.entries()) { + if (fields[index]) { + config = fields[index]; + } + + if (!config) { + continue; + } + + if ('in' in config) { + if (config.key) { + const field = map.get(config.key)!; + const name = field.map || config.key; + if (field.in) { + (params[field.in] as Record)[name] = arg; + } + } else { + params.body = arg; + } + } else { + for (const [key, value] of Object.entries(arg ?? {})) { + const field = map.get(key); + + if (field) { + if (field.in) { + const name = field.map || key; + (params[field.in] as Record)[name] = value; + } else { + params[field.map] = value; + } + } else { + const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix)); + + if (extra) { + const [prefix, slot] = extra; + (params[slot] as Record)[key.slice(prefix.length)] = value; + } else if ('allowExtra' in config && config.allowExtra) { + for (const [slot, allowed] of Object.entries(config.allowExtra)) { + if (allowed) { + (params[slot as Slot] as Record)[key] = value; + break; + } + } + } + } + } + } + } + + stripEmptySlots(params); + + return params; +}; diff --git a/vtex/server/generated/external-promotions-protocol/core/pathSerializer.gen.ts b/vtex/server/generated/external-promotions-protocol/core/pathSerializer.gen.ts new file mode 100644 index 00000000..994b2848 --- /dev/null +++ b/vtex/server/generated/external-promotions-protocol/core/pathSerializer.gen.ts @@ -0,0 +1,171 @@ +// This file is auto-generated by @hey-api/openapi-ts + +interface SerializeOptions extends SerializePrimitiveOptions, SerializerOptions {} + +interface SerializePrimitiveOptions { + allowReserved?: boolean; + name: string; +} + +export interface SerializerOptions { + /** + * @default true + */ + explode: boolean; + style: T; +} + +export type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited'; +export type ArraySeparatorStyle = ArrayStyle | MatrixStyle; +type MatrixStyle = 'label' | 'matrix' | 'simple'; +export type ObjectStyle = 'form' | 'deepObject'; +type ObjectSeparatorStyle = ObjectStyle | MatrixStyle; + +interface SerializePrimitiveParam extends SerializePrimitiveOptions { + value: string; +} + +export const separatorArrayExplode = (style: ArraySeparatorStyle) => { + switch (style) { + case 'label': + return '.'; + case 'matrix': + return ';'; + case 'simple': + return ','; + default: + return '&'; + } +}; + +export const separatorArrayNoExplode = (style: ArraySeparatorStyle) => { + switch (style) { + case 'form': + return ','; + case 'pipeDelimited': + return '|'; + case 'spaceDelimited': + return '%20'; + default: + return ','; + } +}; + +export const separatorObjectExplode = (style: ObjectSeparatorStyle) => { + switch (style) { + case 'label': + return '.'; + case 'matrix': + return ';'; + case 'simple': + return ','; + default: + return '&'; + } +}; + +export const serializeArrayParam = ({ + allowReserved, + explode, + name, + style, + value, +}: SerializeOptions & { + value: unknown[]; +}) => { + if (!explode) { + const joinedValues = ( + allowReserved ? value : value.map((v) => encodeURIComponent(v as string)) + ).join(separatorArrayNoExplode(style)); + switch (style) { + case 'label': + return `.${joinedValues}`; + case 'matrix': + return `;${name}=${joinedValues}`; + case 'simple': + return joinedValues; + default: + return `${name}=${joinedValues}`; + } + } + + const separator = separatorArrayExplode(style); + const joinedValues = value + .map((v) => { + if (style === 'label' || style === 'simple') { + return allowReserved ? v : encodeURIComponent(v as string); + } + + return serializePrimitiveParam({ + allowReserved, + name, + value: v as string, + }); + }) + .join(separator); + return style === 'label' || style === 'matrix' ? separator + joinedValues : joinedValues; +}; + +export const serializePrimitiveParam = ({ + allowReserved, + name, + value, +}: SerializePrimitiveParam) => { + if (value === undefined || value === null) { + return ''; + } + + if (typeof value === 'object') { + throw new Error( + 'Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.', + ); + } + + return `${name}=${allowReserved ? value : encodeURIComponent(value)}`; +}; + +export const serializeObjectParam = ({ + allowReserved, + explode, + name, + style, + value, + valueOnly, +}: SerializeOptions & { + value: Record | Date; + valueOnly?: boolean; +}) => { + if (value instanceof Date) { + return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`; + } + + if (style !== 'deepObject' && !explode) { + let values: string[] = []; + Object.entries(value).forEach(([key, v]) => { + values = [...values, key, allowReserved ? (v as string) : encodeURIComponent(v as string)]; + }); + const joinedValues = values.join(','); + switch (style) { + case 'form': + return `${name}=${joinedValues}`; + case 'label': + return `.${joinedValues}`; + case 'matrix': + return `;${name}=${joinedValues}`; + default: + return joinedValues; + } + } + + const separator = separatorObjectExplode(style); + const joinedValues = Object.entries(value) + .map(([key, v]) => + serializePrimitiveParam({ + allowReserved, + name: style === 'deepObject' ? `${name}[${key}]` : key, + value: v as string, + }), + ) + .join(separator); + return style === 'label' || style === 'matrix' ? separator + joinedValues : joinedValues; +}; diff --git a/vtex/server/generated/external-promotions-protocol/core/queryKeySerializer.gen.ts b/vtex/server/generated/external-promotions-protocol/core/queryKeySerializer.gen.ts new file mode 100644 index 00000000..5000df60 --- /dev/null +++ b/vtex/server/generated/external-promotions-protocol/core/queryKeySerializer.gen.ts @@ -0,0 +1,117 @@ +// This file is auto-generated by @hey-api/openapi-ts + +/** + * JSON-friendly union that mirrors what Pinia Colada can hash. + */ +export type JsonValue = + | null + | string + | number + | boolean + | JsonValue[] + | { [key: string]: JsonValue }; + +/** + * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes. + */ +export const queryKeyJsonReplacer = (_key: string, value: unknown) => { + if (value === undefined || typeof value === 'function' || typeof value === 'symbol') { + return undefined; + } + if (typeof value === 'bigint') { + return value.toString(); + } + if (value instanceof Date) { + return value.toISOString(); + } + return value; +}; + +/** + * Safely stringifies a value and parses it back into a JsonValue. + */ +export const stringifyToJsonValue = (input: unknown): JsonValue | undefined => { + try { + const json = JSON.stringify(input, queryKeyJsonReplacer); + if (json === undefined) { + return undefined; + } + return JSON.parse(json) as JsonValue; + } catch { + return undefined; + } +}; + +/** + * Detects plain objects (including objects with a null prototype). + */ +const isPlainObject = (value: unknown): value is Record => { + if (value === null || typeof value !== 'object') { + return false; + } + const prototype = Object.getPrototypeOf(value as object); + return prototype === Object.prototype || prototype === null; +}; + +/** + * Turns URLSearchParams into a sorted JSON object for deterministic keys. + */ +const serializeSearchParams = (params: URLSearchParams): JsonValue => { + const entries = Array.from(params.entries()).sort(([a], [b]) => a.localeCompare(b)); + const result: Record = {}; + + for (const [key, value] of entries) { + const existing = result[key]; + if (existing === undefined) { + result[key] = value; + continue; + } + + if (Array.isArray(existing)) { + (existing as string[]).push(value); + } else { + result[key] = [existing, value]; + } + } + + return result; +}; + +/** + * Normalizes any accepted value into a JSON-friendly shape for query keys. + */ +export const serializeQueryKeyValue = (value: unknown): JsonValue | undefined => { + if (value === null) { + return null; + } + + if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { + return value; + } + + if (value === undefined || typeof value === 'function' || typeof value === 'symbol') { + return undefined; + } + + if (typeof value === 'bigint') { + return value.toString(); + } + + if (value instanceof Date) { + return value.toISOString(); + } + + if (Array.isArray(value)) { + return stringifyToJsonValue(value); + } + + if (typeof URLSearchParams !== 'undefined' && value instanceof URLSearchParams) { + return serializeSearchParams(value); + } + + if (isPlainObject(value)) { + return stringifyToJsonValue(value); + } + + return undefined; +}; diff --git a/vtex/server/generated/external-promotions-protocol/core/serverSentEvents.gen.ts b/vtex/server/generated/external-promotions-protocol/core/serverSentEvents.gen.ts new file mode 100644 index 00000000..6aa6cf02 --- /dev/null +++ b/vtex/server/generated/external-promotions-protocol/core/serverSentEvents.gen.ts @@ -0,0 +1,243 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Config } from './types.gen'; + +export type ServerSentEventsOptions = Omit & + Pick & { + /** + * Fetch API implementation. You can use this option to provide a custom + * fetch instance. + * + * @default globalThis.fetch + */ + fetch?: typeof fetch; + /** + * Implementing clients can call request interceptors inside this hook. + */ + onRequest?: (url: string, init: RequestInit) => Promise; + /** + * Callback invoked when a network or parsing error occurs during streaming. + * + * This option applies only if the endpoint returns a stream of events. + * + * @param error The error that occurred. + */ + onSseError?: (error: unknown) => void; + /** + * Callback invoked when an event is streamed from the server. + * + * This option applies only if the endpoint returns a stream of events. + * + * @param event Event streamed from the server. + * @returns Nothing (void). + */ + onSseEvent?: (event: StreamEvent) => void; + serializedBody?: RequestInit['body']; + /** + * Default retry delay in milliseconds. + * + * This option applies only if the endpoint returns a stream of events. + * + * @default 3000 + */ + sseDefaultRetryDelay?: number; + /** + * Maximum number of retry attempts before giving up. + */ + sseMaxRetryAttempts?: number; + /** + * Maximum retry delay in milliseconds. + * + * Applies only when exponential backoff is used. + * + * This option applies only if the endpoint returns a stream of events. + * + * @default 30000 + */ + sseMaxRetryDelay?: number; + /** + * Optional sleep function for retry backoff. + * + * Defaults to using `setTimeout`. + */ + sseSleepFn?: (ms: number) => Promise; + url: string; + }; + +export interface StreamEvent { + data: TData; + event?: string; + id?: string; + retry?: number; +} + +export type ServerSentEventsResult = { + stream: AsyncGenerator< + TData extends Record ? TData[keyof TData] : TData, + TReturn, + TNext + >; +}; + +export const createSseClient = ({ + onRequest, + onSseError, + onSseEvent, + responseTransformer, + responseValidator, + sseDefaultRetryDelay, + sseMaxRetryAttempts, + sseMaxRetryDelay, + sseSleepFn, + url, + ...options +}: ServerSentEventsOptions): ServerSentEventsResult => { + let lastEventId: string | undefined; + + const sleep = sseSleepFn ?? ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms))); + + const createStream = async function* () { + let retryDelay: number = sseDefaultRetryDelay ?? 3000; + let attempt = 0; + const signal = options.signal ?? new AbortController().signal; + + while (true) { + if (signal.aborted) break; + + attempt++; + + const headers = + options.headers instanceof Headers + ? options.headers + : new Headers(options.headers as Record | undefined); + + if (lastEventId !== undefined) { + headers.set('Last-Event-ID', lastEventId); + } + + try { + const requestInit: RequestInit = { + redirect: 'follow', + ...options, + body: options.serializedBody, + headers, + signal, + }; + let request = new Request(url, requestInit); + if (onRequest) { + request = await onRequest(url, requestInit); + } + // fetch must be assigned here, otherwise it would throw the error: + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation + const _fetch = options.fetch ?? globalThis.fetch; + const response = await _fetch(request); + + if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`); + + if (!response.body) throw new Error('No body in SSE response'); + + const reader = response.body.pipeThrough(new TextDecoderStream()).getReader(); + + let buffer = ''; + + const abortHandler = () => { + try { + reader.cancel(); + } catch { + // noop + } + }; + + signal.addEventListener('abort', abortHandler); + + try { + while (true) { + const { done, value } = await reader.read(); + if (done) break; + buffer += value; + // Normalize line endings: CRLF -> LF, then CR -> LF + buffer = buffer.replace(/\r\n/g, '\n').replace(/\r/g, '\n'); + + const chunks = buffer.split('\n\n'); + buffer = chunks.pop() ?? ''; + + for (const chunk of chunks) { + const lines = chunk.split('\n'); + const dataLines: Array = []; + let eventName: string | undefined; + + for (const line of lines) { + if (line.startsWith('data:')) { + dataLines.push(line.replace(/^data:\s*/, '')); + } else if (line.startsWith('event:')) { + eventName = line.replace(/^event:\s*/, ''); + } else if (line.startsWith('id:')) { + lastEventId = line.replace(/^id:\s*/, ''); + } else if (line.startsWith('retry:')) { + const parsed = Number.parseInt(line.replace(/^retry:\s*/, ''), 10); + if (!Number.isNaN(parsed)) { + retryDelay = parsed; + } + } + } + + let data: unknown; + let parsedJson = false; + + if (dataLines.length) { + const rawData = dataLines.join('\n'); + try { + data = JSON.parse(rawData); + parsedJson = true; + } catch { + data = rawData; + } + } + + if (parsedJson) { + if (responseValidator) { + await responseValidator(data); + } + + if (responseTransformer) { + data = await responseTransformer(data); + } + } + + onSseEvent?.({ + data, + event: eventName, + id: lastEventId, + retry: retryDelay, + }); + + if (dataLines.length) { + yield data as any; + } + } + } + } finally { + signal.removeEventListener('abort', abortHandler); + reader.releaseLock(); + } + + break; // exit loop on normal completion + } catch (error) { + // connection failed or aborted; retry after delay + onSseError?.(error); + + if (sseMaxRetryAttempts !== undefined && attempt >= sseMaxRetryAttempts) { + break; // stop after firing error + } + + // exponential backoff: double retry each attempt, cap at 30s + const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 30000); + await sleep(backoff); + } + } + }; + + const stream = createStream(); + + return { stream }; +}; diff --git a/vtex/server/generated/external-promotions-protocol/core/types.gen.ts b/vtex/server/generated/external-promotions-protocol/core/types.gen.ts new file mode 100644 index 00000000..97463257 --- /dev/null +++ b/vtex/server/generated/external-promotions-protocol/core/types.gen.ts @@ -0,0 +1,104 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Auth, AuthToken } from './auth.gen'; +import type { BodySerializer, QuerySerializer, QuerySerializerOptions } from './bodySerializer.gen'; + +export type HttpMethod = + | 'connect' + | 'delete' + | 'get' + | 'head' + | 'options' + | 'patch' + | 'post' + | 'put' + | 'trace'; + +export type Client< + RequestFn = never, + Config = unknown, + MethodFn = never, + BuildUrlFn = never, + SseFn = never, +> = { + /** + * Returns the final request URL. + */ + buildUrl: BuildUrlFn; + getConfig: () => Config; + request: RequestFn; + setConfig: (config: Config) => Config; +} & { + [K in HttpMethod]: MethodFn; +} & ([SseFn] extends [never] ? { sse?: never } : { sse: { [K in HttpMethod]: SseFn } }); + +export interface Config { + /** + * Auth token or a function returning auth token. The resolved value will be + * added to the request payload as defined by its `security` array. + */ + auth?: ((auth: Auth) => Promise | AuthToken) | AuthToken; + /** + * A function for serializing request body parameter. By default, + * {@link JSON.stringify()} will be used. + */ + bodySerializer?: BodySerializer | null; + /** + * An object containing any HTTP headers that you want to pre-populate your + * `Headers` object with. + * + * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more} + */ + headers?: + | RequestInit['headers'] + | Record< + string, + string | number | boolean | (string | number | boolean)[] | null | undefined | unknown + >; + /** + * The request method. + * + * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more} + */ + method?: Uppercase; + /** + * A function for serializing request query parameters. By default, arrays + * will be exploded in form style, objects will be exploded in deepObject + * style, and reserved characters are percent-encoded. + * + * This method will have no effect if the native `paramsSerializer()` Axios + * API function is used. + * + * {@link https://swagger.io/docs/specification/serialization/#query View examples} + */ + querySerializer?: QuerySerializer | QuerySerializerOptions; + /** + * A function validating request data. This is useful if you want to ensure + * the request conforms to the desired shape, so it can be safely sent to + * the server. + */ + requestValidator?: (data: unknown) => Promise; + /** + * A function transforming response data before it's returned. This is useful + * for post-processing data, e.g. converting ISO strings into Date objects. + */ + responseTransformer?: (data: unknown) => Promise; + /** + * A function validating response data. This is useful if you want to ensure + * the response conforms to the desired shape, so it can be safely passed to + * the transformers and returned to the user. + */ + responseValidator?: (data: unknown) => Promise; +} + +type IsExactlyNeverOrNeverUndefined = [T] extends [never] + ? true + : [T] extends [never | undefined] + ? [undefined] extends [T] + ? false + : true + : false; + +export type OmitNever> = { + [K in keyof T as IsExactlyNeverOrNeverUndefined extends true ? never : K]: T[K]; +}; diff --git a/vtex/server/generated/external-promotions-protocol/core/utils.gen.ts b/vtex/server/generated/external-promotions-protocol/core/utils.gen.ts new file mode 100644 index 00000000..e7ddbe35 --- /dev/null +++ b/vtex/server/generated/external-promotions-protocol/core/utils.gen.ts @@ -0,0 +1,140 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; +import { + type ArraySeparatorStyle, + serializeArrayParam, + serializeObjectParam, + serializePrimitiveParam, +} from './pathSerializer.gen'; + +export interface PathSerializer { + path: Record; + url: string; +} + +export const PATH_PARAM_RE = /\{[^{}]+\}/g; + +export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { + let url = _url; + const matches = _url.match(PATH_PARAM_RE); + if (matches) { + for (const match of matches) { + let explode = false; + let name = match.substring(1, match.length - 1); + let style: ArraySeparatorStyle = 'simple'; + + if (name.endsWith('*')) { + explode = true; + name = name.substring(0, name.length - 1); + } + + if (name.startsWith('.')) { + name = name.substring(1); + style = 'label'; + } else if (name.startsWith(';')) { + name = name.substring(1); + style = 'matrix'; + } + + const value = path[name]; + + if (value === undefined || value === null) { + continue; + } + + if (Array.isArray(value)) { + url = url.replace(match, serializeArrayParam({ explode, name, style, value })); + continue; + } + + if (typeof value === 'object') { + url = url.replace( + match, + serializeObjectParam({ + explode, + name, + style, + value: value as Record, + valueOnly: true, + }), + ); + continue; + } + + if (style === 'matrix') { + url = url.replace( + match, + `;${serializePrimitiveParam({ + name, + value: value as string, + })}`, + ); + continue; + } + + const replaceValue = encodeURIComponent( + style === 'label' ? `.${value as string}` : (value as string), + ); + url = url.replace(match, replaceValue); + } + } + return url; +}; + +export const getUrl = ({ + baseUrl, + path, + query, + querySerializer, + url: _url, +}: { + baseUrl?: string; + path?: Record; + query?: Record; + querySerializer: QuerySerializer; + url: string; +}) => { + const pathUrl = _url.startsWith('/') ? _url : `/${_url}`; + let url = (baseUrl ?? '') + pathUrl; + if (path) { + url = defaultPathSerializer({ path, url }); + } + let search = query ? querySerializer(query) : ''; + if (search.startsWith('?')) { + search = search.substring(1); + } + if (search) { + url += `?${search}`; + } + return url; +}; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // not all clients implement a serializedBody property (i.e. client-axios) + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/vtex/server/generated/external-promotions-protocol/index.ts b/vtex/server/generated/external-promotions-protocol/index.ts new file mode 100644 index 00000000..c354fa9f --- /dev/null +++ b/vtex/server/generated/external-promotions-protocol/index.ts @@ -0,0 +1,4 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export { type Options, postCalculatePromotion, postNotifyUsage } from './sdk.gen'; +export type { Accept, ClientOptions, ContentType, PostCalculatePromotionData, PostCalculatePromotionErrors, PostCalculatePromotionResponse, PostCalculatePromotionResponses, PostNotifyUsageData, PostNotifyUsageErrors, PostNotifyUsageResponses } from './types.gen'; diff --git a/vtex/server/generated/external-promotions-protocol/sdk.gen.ts b/vtex/server/generated/external-promotions-protocol/sdk.gen.ts new file mode 100644 index 00000000..3de734ab --- /dev/null +++ b/vtex/server/generated/external-promotions-protocol/sdk.gen.ts @@ -0,0 +1,53 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Client, Options as Options2, TDataShape } from './client'; +import { client } from './client.gen'; +import type { PostCalculatePromotionData, PostCalculatePromotionErrors, PostCalculatePromotionResponses, PostNotifyUsageData, PostNotifyUsageErrors, PostNotifyUsageResponses } from './types.gen'; + +export type Options = Options2 & { + /** + * You can provide a client instance returned by `createClient()` instead of + * individual options. This might be also useful if you want to implement a + * custom client. + */ + client?: Client; + /** + * You can pass arbitrary values through the `meta` object. This can be + * used to access values that aren't defined as part of the SDK function. + */ + meta?: Record; +}; + +/** + * Calculate promotions + * + * Calculates the promotions and discounts applicable to a given shopping cart. VTEX calls this endpoint during the cart calculation process, sending the shopping cart data including items, coupon codes, UTM parameters, and sales channel information. The external promotions provider must return the calculated discounts for each item, along with a summary of all promotions considered. + * + * This endpoint supports **hybrid** orchestration (protocol v1.1). When an account combines native VTEX promotions with an external provider, VTEX sends the cart **after** native evaluation: see `items[].price` (post-native per-unit price) and the optional per-line `items[].nativePromotionLayer`. The provider may also return `allPromotions[].qualificationProgress` describing promotions the shopper has **not yet unlocked**. + * + * ## Authentication + * + * VTEX authenticates to the provider using the credentials configured for the account. By default this is an API key sent in the `X-API-Key` header (HTTP Basic is also supported). The provider should reject unauthenticated requests with `401 Unauthorized`. + */ +export const postCalculatePromotion = (options: Options) => (options.client ?? client).post({ + security: [{ name: 'X-API-Key', type: 'apiKey' }, { scheme: 'basic', type: 'http' }], + url: '/calculatePromotion', + ...options +}); + +/** + * Notify promotion usage + * + * Receives a notification when an order is created or cancelled, informing the external promotions provider which promotions and coupons were applied to the order. This allows the provider to track promotion usage, enforce usage limits, and maintain accurate promotion state. + * + * The optional `correlationId` references the `calculatePromotion` evaluation that led to the order, when VTEX can supply it, for end-to-end tracing. Added in protocol v1.1. + * + * ## Authentication + * + * VTEX authenticates to the provider using the credentials configured for the account (API key in the `X-API-Key` header by default; HTTP Basic also supported). The provider should reject unauthenticated requests with `401 Unauthorized`. + */ +export const postNotifyUsage = (options: Options) => (options.client ?? client).post({ + security: [{ name: 'X-API-Key', type: 'apiKey' }, { scheme: 'basic', type: 'http' }], + url: '/notifyUsage', + ...options +}); diff --git a/vtex/server/generated/external-promotions-protocol/types.gen.ts b/vtex/server/generated/external-promotions-protocol/types.gen.ts new file mode 100644 index 00000000..50935bda --- /dev/null +++ b/vtex/server/generated/external-promotions-protocol/types.gen.ts @@ -0,0 +1,503 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type ClientOptions = { + baseUrl: 'https://{providerApiEndpoint}' | (string & {}); +}; + +/** + * Type of the content being sent. + */ +export type ContentType = string; + +/** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ +export type Accept = string; + +export type PostCalculatePromotionData = { + /** + * Request body for the calculate promotions endpoint. + */ + body: { + /** + * Unique identifier for this `calculatePromotion` call, stable across client retries of the same cart step. VTEX links it to execution diagnostics; providers should log it and may use it for idempotency. Added in protocol v1.1. + */ + correlationId: string; + /** + * Origin of the shopping cart. Possible values are `Marketplace` and `Fulfillment`. + */ + origin: 'Marketplace' | 'Fulfillment'; + /** + * Unique identifier of the shopper's profile. + */ + shopperProfileId?: string | null; + /** + * Identifier of the sales channel (trade policy) associated with the shopping cart, as configured on VTEX. + */ + salesChannelId: string; + /** + * List of coupon codes added to the shopping cart. + */ + couponCodes?: Array | null; + /** + * UTM tracking parameters associated with the shopping cart. + */ + utms?: { + /** + * UTM source value. + */ + source?: string | null; + /** + * UTM medium value. + */ + medium?: string | null; + /** + * UTM campaign value. + */ + campaign?: string | null; + /** + * UTM internal campaign value. + */ + internalCampaign?: string | null; + } | null; + /** + * Arbitrary custom data forwarded from the cart, grouped by app. The outer keys are app identifiers; each value is a map of field name to string value. Field values longer than 128 characters are dropped by VTEX before sending. Added in protocol v1.1. + */ + customFields?: { + [key: string]: { + [key: string]: string; + }; + } | null; + /** + * List of items in the shopping cart. + */ + items: Array<{ + /** + * SKU identifier of the item, as configured in the VTEX catalog. + */ + id: string; + /** + * Identifier of the seller, as configured on VTEX. + */ + sellerId: string; + /** + * Quantity of this item in the shopping cart. + */ + quantity: number; + /** + * Per-unit selling price of the item before the external engine applies. In **hybrid** mode this is the per-unit price **after** native VTEX promotions, so the provider can stack on top. In external-only mode this is the pre-external selling price. + */ + price: number; + /** + * Catalog information associated with this item. + */ + catalogInfo: { + /** + * Brand identifier of the item, as configured in the VTEX catalog. + */ + brandId: string; + /** + * Category identifier of the item, as configured in the VTEX catalog. + */ + categoryId: string; + /** + * Product identifier of the item, as configured in the VTEX catalog. + */ + productId: string; + /** + * List of collection identifiers this item belongs to, as configured in the VTEX catalog. + */ + collectionIds?: Array | null; + /** + * EAN (barcode) of the item, when VTEX has it. Added in protocol v1.1. + */ + ean?: string | null; + /** + * Merchant reference id (RefId) of the item, when VTEX has it. Added in protocol v1.1. + */ + refId?: string | null; + }; + /** + * List of payment methods applied to this item. + */ + paymentInfo?: Array<{ + /** + * Identifier of the payment method, as configured on VTEX. + */ + id: string; + /** + * Value paid with this payment method. + */ + value: number; + }> | null; + /** + * Hybrid only. How native VTEX promotions changed this line before the external engine runs. When present, `priceAfterLayer` equals `price`. Added in protocol v1.1. + */ + nativePromotionLayer?: { + /** + * Per-unit price before native promotions. + */ + priceBeforeLayer: number; + /** + * Per-unit price after native promotions (equals `price` in hybrid mode). + */ + priceAfterLayer: number; + /** + * Native promotions applied in this layer only. + */ + appliedPromotions?: Array<{ + /** + * Identifier of the native promotion. + */ + id: string; + /** + * Per-unit discount applied by this promotion. + */ + discount: number; + /** + * Type of discount applied. Currently, only `Nominal` is supported. + */ + type: 'Nominal'; + }> | null; + } | null; + }>; + }; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path?: never; + query?: never; + url: '/calculatePromotion'; +}; + +export type PostCalculatePromotionErrors = { + /** + * Bad Request + */ + 400: unknown; + /** + * Unauthorized + */ + 401: unknown; +}; + +export type PostCalculatePromotionResponses = { + /** + * Response body for the calculate promotions endpoint. + */ + 200: { + /** + * List of items with their calculated promotion results. + */ + items: Array<{ + /** + * SKU identifier of the item in the shopping cart. + */ + id: string; + /** + * Quantity of the item in the shopping cart. + */ + quantity: number; + /** + * List of promotions applied to this item. + */ + promotions?: Array<{ + /** + * Identifier of the applied promotion. + */ + id: string; + /** + * Discount value applied by this promotion. + */ + discount: number; + /** + * Type of discount applied. Currently, only `Nominal` is supported. + */ + type: 'Nominal'; + }> | null; + /** + * Original per-unit price of this line before external deals. In hybrid mode, typically the per-unit price after native promotions (the pre-external price the provider augments). + */ + originalPrice: number; + /** + * Per-unit price of the item after external promotions are applied. + */ + discountedPrice?: number | null; + /** + * Hybrid: how the partner (external) promotion layer changed this line. When set, `priceBeforeLayer` matches `originalPrice` and `priceAfterLayer` matches `discountedPrice`. Added in protocol v1.1. + */ + externalPromotionLayer?: { + /** + * Per-unit price before the partner layer (post-native in hybrid). + */ + priceBeforeLayer: number; + /** + * Per-unit price after the partner layer. + */ + priceAfterLayer: number; + /** + * Partner deals applied in this layer only. + */ + appliedPromotions?: Array<{ + /** + * Identifier of the applied promotion. + */ + id: string; + /** + * Per-unit discount applied by this promotion. + */ + discount: number; + /** + * Type of discount applied. Currently, only `Nominal` is supported. + */ + type: 'Nominal'; + }> | null; + } | null; + }>; + /** + * List of all promotions considered for this shopping cart, including those that were not applied. + */ + allPromotions?: Array<{ + /** + * Identifier of the promotion. + */ + id: string; + /** + * Name of the promotion. + */ + name: string; + /** + * Description of the promotion. + */ + description: string; + /** + * Coupon code that triggers this promotion. Returns `null` if no coupon code triggered the promotion. + */ + couponCode?: string | null; + /** + * For **not-yet-unlocked** promotions, structured qualification data VTEX maps to native teasers ("almost there" messaging). All properties are optional; omit the object (or send `{}`) when there is no structured progress. Added in protocol v1.1; not present in v1.0. + */ + qualificationProgress?: { + /** + * Monetary amount still needed across the whole cart to meet a cart-wide spend threshold (the remaining gap, not the full threshold). + */ + remainingCartWideAmount?: number | null; + /** + * Cart items-subtotal floor the rule requires (the target threshold). + */ + orderSubtotalMustExceed?: number | null; + /** + * Item/SKU quantity qualification context: optional aggregate and per-SKU rows. + */ + remainingItemQuantity?: { + /** + * Aggregate extra units still needed across the qualifying SKU set. + */ + totalUnitsRemaining?: number | null; + /** + * Per-SKU contribution toward the quantity conditions. + */ + perSku?: Array<{ + /** + * Cart/catalog line id, aligned with items[].id in the same request. + */ + skuId: string; + /** + * Units of this SKU currently in the cart toward this promotion. + */ + unitsInCart?: number | null; + /** + * Units of this SKU required by the rule. + */ + unitsRequiredForPromotion?: number | null; + /** + * Units of this SKU still needed to satisfy its part of the condition. + */ + unitsRemaining?: number | null; + }> | null; + } | null; + /** + * Minimum qualifying units the rule requires (e.g. buy-N / combo thresholds). + */ + minimumRuleQuantity?: number | null; + /** + * Subtotal value range and item scope for total-value rules. + */ + contextTotalForQualifyingItems?: { + /** + * Minimum subtotal in cart currency. + */ + minValue?: number | null; + /** + * Maximum subtotal bound. + */ + maxValue?: number | null; + /** + * Which line items' value participates in the subtotal check. + */ + itemScope?: 'AllItems' | 'IncludeMatchedItems' | 'ExcludeMatchedItems'; + } | null; + /** + * Per-unit price band on a line. + */ + itemUnitPriceBounds?: { + /** + * Minimum per-unit item price for qualification. + */ + minPrice?: number | null; + /** + * Maximum per-unit item price for qualification. + */ + maxPrice?: number | null; + } | null; + /** + * SKUs in scope of the rule. Use `allOf` for a single set; `group1`/`group2` for mix-and-match. + */ + skuIdGroups?: { + /** + * All listed SKUs participate in a single set. + */ + allOf?: Array | null; + /** + * First SKU group in a two-group rule. + */ + group1?: Array | null; + /** + * Second SKU group in a two-group rule. + */ + group2?: Array | null; + } | null; + /** + * Collection / cluster ids in scope. + */ + productCollectionIds?: Array | null; + /** + * Brand ids in scope. + */ + brandIds?: Array | null; + /** + * Category ids in scope. + */ + categoryIds?: Array | null; + /** + * Delivery CEP/zip gating ranges. + */ + zipCodeRangeSegments?: Array<{ + /** + * Range start, digits only (no mask). + */ + from?: string; + /** + * Range end, digits only (no mask). + */ + to?: string; + /** + * Whether the shopper's zip is included (`inclusive`) or excluded (`exclusive`). + */ + inclusivity?: 'inclusive' | 'exclusive'; + }> | null; + /** + * Payment method ids the shopper must use. + */ + paymentMethodIds?: Array | null; + /** + * Allowed card issuers. + */ + cardIssuerIds?: Array | null; + /** + * Card BIN prefix patterns the card number must satisfy. + */ + cardBinPrefixRestrictions?: Array | null; + /** + * Minimum installments required. + */ + minInstallmentCount?: number | null; + /** + * Maximum installments allowed. + */ + maxInstallmentCount?: number | null; + /** + * UI grouping hints for the teaser message. + */ + teaserStyleHints?: Array<'UpPrice' | 'Profiler' | 'Catalog' | 'ConditionalPrice'> | null; + } | null; + }> | null; + }; +}; + +export type PostCalculatePromotionResponse = PostCalculatePromotionResponses[keyof PostCalculatePromotionResponses]; + +export type PostNotifyUsageData = { + /** + * Request body for the notify usage endpoint. + */ + body: { + /** + * When available, the `correlationId` of the `calculatePromotion` evaluation that led to this order, for end-to-end tracing. Added in protocol v1.1. + */ + correlationId?: string | null; + /** + * Identifier of the order triggering this notification. + */ + orderId: string; + /** + * Type of notification. `NewOrder` indicates a new order was placed, and `OrderCancellation` indicates an order was cancelled. + */ + type: 'NewOrder' | 'OrderCancellation'; + /** + * List of promotions used in this order. + */ + promotionUsages: Array<{ + /** + * Identifier of the applied promotion. + */ + promotionId: string; + /** + * Total discount value given by this promotion. + */ + discount: number; + /** + * Coupon code that triggered this promotion. Returns `null` if no coupon code triggered the promotion. + */ + couponCode?: string | null; + }>; + }; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path?: never; + query?: never; + url: '/notifyUsage'; +}; + +export type PostNotifyUsageErrors = { + /** + * Bad Request + */ + 400: unknown; + /** + * Unauthorized + */ + 401: unknown; +}; + +export type PostNotifyUsageResponses = { + /** + * OK + */ + 200: unknown; +}; diff --git a/vtex/server/generated/external-promotions-protocol/zod.gen.ts b/vtex/server/generated/external-promotions-protocol/zod.gen.ts new file mode 100644 index 00000000..f6c821b6 --- /dev/null +++ b/vtex/server/generated/external-promotions-protocol/zod.gen.ts @@ -0,0 +1,130 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import * as z from 'zod'; + +/** + * Type of the content being sent. + */ +export const zContentType = z.string(); + +/** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ +export const zAccept = z.string(); + +export const zPostCalculatePromotionData = z.object({ + body: z.object({ + correlationId: z.string(), + origin: z.enum(['Marketplace', 'Fulfillment']), + shopperProfileId: z.optional(z.union([ + z.string(), + z.null() + ])), + salesChannelId: z.string(), + couponCodes: z.optional(z.union([ + z.array(z.string()), + z.null() + ])), + utms: z.optional(z.union([ + z.object({ + source: z.optional(z.union([ + z.string(), + z.null() + ])), + medium: z.optional(z.union([ + z.string(), + z.null() + ])), + campaign: z.optional(z.union([ + z.string(), + z.null() + ])), + internalCampaign: z.optional(z.union([ + z.string(), + z.null() + ])) + }), + z.null() + ])), + customFields: z.optional(z.union([ + z.record(z.string(), z.record(z.string(), z.string())), + z.null() + ])), + items: z.array(z.object({ + id: z.string(), + sellerId: z.string(), + quantity: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }), + price: z.number(), + catalogInfo: z.object({ + brandId: z.string(), + categoryId: z.string(), + productId: z.string(), + collectionIds: z.optional(z.union([ + z.array(z.string()), + z.null() + ])), + ean: z.optional(z.union([ + z.string(), + z.null() + ])), + refId: z.optional(z.union([ + z.string(), + z.null() + ])) + }), + paymentInfo: z.optional(z.union([ + z.array(z.object({ + id: z.string(), + value: z.number() + })), + z.null() + ])), + nativePromotionLayer: z.optional(z.union([ + z.object({ + priceBeforeLayer: z.number(), + priceAfterLayer: z.number(), + appliedPromotions: z.optional(z.union([ + z.array(z.object({ + id: z.string(), + discount: z.number(), + type: z.enum(['Nominal']) + })), + z.null() + ])) + }), + z.null() + ])) + })) + }), + path: z.optional(z.never()), + query: z.optional(z.never()), + headers: z.object({ + 'Content-Type': z.string(), + Accept: z.string() + }) +}); + +export const zPostNotifyUsageData = z.object({ + body: z.object({ + correlationId: z.optional(z.union([ + z.string(), + z.null() + ])), + orderId: z.string(), + type: z.enum(['NewOrder', 'OrderCancellation']), + promotionUsages: z.array(z.object({ + promotionId: z.string(), + discount: z.number(), + couponCode: z.optional(z.union([ + z.string(), + z.null() + ])) + })) + }), + path: z.optional(z.never()), + query: z.optional(z.never()), + headers: z.object({ + 'Content-Type': z.string(), + Accept: z.string() + }) +}); diff --git a/vtex/server/generated/giftcard-provider-protocol/zod.gen.ts b/vtex/server/generated/giftcard-provider-protocol/zod.gen.ts index 3e576068..f00d298a 100644 --- a/vtex/server/generated/giftcard-provider-protocol/zod.gen.ts +++ b/vtex/server/generated/giftcard-provider-protocol/zod.gen.ts @@ -284,8 +284,8 @@ export const zListAllGiftCardsData = z.object({ path: z.optional(z.never()), query: z.optional(z.never()), headers: z.object({ - 'Content-Type': z.string().default('application/vnd.vtex.giftcardproviders.v1+json'), - Accept: z.string().default('application/vnd.vtex.giftcardproviders.v1+json'), + 'Content-Type': z.string().default('application/vnd.vtex.giftcards.v1+json'), + Accept: z.string().default('application/vnd.vtex.giftcards.v1+json'), 'REST-Range': z.optional(z.string()).default('resources=0-49') }) }); @@ -297,8 +297,8 @@ export const zGetGiftCardbyIdData = z.object({ }), query: z.optional(z.never()), headers: z.object({ - 'Content-Type': z.string().default('application/vnd.vtex.giftcardproviders.v1+json'), - Accept: z.string().default('application/vnd.vtex.giftcardproviders.v1+json') + 'Content-Type': z.string().default('application/vnd.vtex.giftcards.v1+json'), + Accept: z.string().default('application/vnd.vtex.giftcards.v1+json') }) }); @@ -307,8 +307,8 @@ export const zCreateGiftCardData = z.object({ path: z.optional(z.never()), query: z.optional(z.never()), headers: z.object({ - 'Content-Type': z.string().default('application/vnd.vtex.giftcardproviders.v1+json'), - Accept: z.string().default('application/vnd.vtex.giftcardproviders.v1+json') + 'Content-Type': z.string().default('application/vnd.vtex.giftcards.v1+json'), + Accept: z.string().default('application/vnd.vtex.giftcards.v1+json') }) }); diff --git a/vtex/server/generated/intelligent-search-api-v1/client.gen.ts b/vtex/server/generated/intelligent-search-api-v1/client.gen.ts new file mode 100644 index 00000000..cab3c701 --- /dev/null +++ b/vtex/server/generated/intelligent-search-api-v1/client.gen.ts @@ -0,0 +1,16 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { type ClientOptions, type Config, createClient, createConfig } from './client'; +import type { ClientOptions as ClientOptions2 } from './types.gen'; + +/** + * The `createClientConfig()` function will be called on client initialization + * and the returned object will become the client's initial configuration. + * + * You may want to initialize your client this way instead of calling + * `setConfig()`. This is useful for example if you're using Next.js + * to ensure your client always has the correct values. + */ +export type CreateClientConfig = (override?: Config) => Config & T>; + +export const client = createClient(createConfig()); diff --git a/vtex/server/generated/intelligent-search-api-v1/client/client.gen.ts b/vtex/server/generated/intelligent-search-api-v1/client/client.gen.ts new file mode 100644 index 00000000..d2e55a14 --- /dev/null +++ b/vtex/server/generated/intelligent-search-api-v1/client/client.gen.ts @@ -0,0 +1,288 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { createSseClient } from '../core/serverSentEvents.gen'; +import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; +import type { Client, Config, RequestOptions, ResolvedRequestOptions } from './types.gen'; +import { + buildUrl, + createConfig, + createInterceptors, + getParseAs, + mergeConfigs, + mergeHeaders, + setAuthParams, +} from './utils.gen'; + +type ReqInit = Omit & { + body?: any; + headers: ReturnType; +}; + +export const createClient = (config: Config = {}): Client => { + let _config = mergeConfigs(createConfig(), config); + + const getConfig = (): Config => ({ ..._config }); + + const setConfig = (config: Config): Config => { + _config = mergeConfigs(_config, config); + return getConfig(); + }; + + const interceptors = createInterceptors(); + + const beforeRequest = async (options: RequestOptions) => { + const opts = { + ..._config, + ...options, + fetch: options.fetch ?? _config.fetch ?? globalThis.fetch, + headers: mergeHeaders(_config.headers, options.headers), + serializedBody: undefined, + }; + + if (opts.security) { + await setAuthParams({ + ...opts, + security: opts.security, + }); + } + + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + + if (opts.body !== undefined && opts.bodySerializer) { + opts.serializedBody = opts.bodySerializer(opts.body); + } + + // remove Content-Type header if body is empty to avoid sending invalid requests + if (opts.body === undefined || opts.serializedBody === '') { + opts.headers.delete('Content-Type'); + } + + const url = buildUrl(opts); + + return { opts, url }; + }; + + const request: Client['request'] = async (options) => { + // @ts-expect-error + const { opts, url } = await beforeRequest(options); + const requestInit: ReqInit = { + redirect: 'follow', + ...opts, + body: getValidRequestBody(opts), + }; + + let request = new Request(url, requestInit); + + for (const fn of interceptors.request.fns) { + if (fn) { + request = await fn(request, opts); + } + } + + // fetch must be assigned here, otherwise it would throw the error: + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation + const _fetch = opts.fetch!; + let response: Response; + + try { + response = await _fetch(request); + } catch (error) { + // Handle fetch exceptions (AbortError, network errors, etc.) + let finalError = error; + + for (const fn of interceptors.error.fns) { + if (fn) { + finalError = (await fn(error, undefined as any, request, opts)) as unknown; + } + } + + finalError = finalError || ({} as unknown); + + if (opts.throwOnError) { + throw finalError; + } + + // Return error response + return opts.responseStyle === 'data' + ? undefined + : { + error: finalError, + request, + response: undefined as any, + }; + } + + for (const fn of interceptors.response.fns) { + if (fn) { + response = await fn(response, request, opts); + } + } + + const result = { + request, + response, + }; + + if (response.ok) { + const parseAs = + (opts.parseAs === 'auto' + ? getParseAs(response.headers.get('Content-Type')) + : opts.parseAs) ?? 'json'; + + if (response.status === 204 || response.headers.get('Content-Length') === '0') { + let emptyData: any; + switch (parseAs) { + case 'arrayBuffer': + case 'blob': + case 'text': + emptyData = await response[parseAs](); + break; + case 'formData': + emptyData = new FormData(); + break; + case 'stream': + emptyData = response.body; + break; + case 'json': + default: + emptyData = {}; + break; + } + return opts.responseStyle === 'data' + ? emptyData + : { + data: emptyData, + ...result, + }; + } + + let data: any; + switch (parseAs) { + case 'arrayBuffer': + case 'blob': + case 'formData': + case 'text': + data = await response[parseAs](); + break; + case 'json': { + // Some servers return 200 with no Content-Length and empty body. + // response.json() would throw; read as text and parse if non-empty. + const text = await response.text(); + data = text ? JSON.parse(text) : {}; + break; + } + case 'stream': + return opts.responseStyle === 'data' + ? response.body + : { + data: response.body, + ...result, + }; + } + + if (parseAs === 'json') { + if (opts.responseValidator) { + await opts.responseValidator(data); + } + + if (opts.responseTransformer) { + data = await opts.responseTransformer(data); + } + } + + return opts.responseStyle === 'data' + ? data + : { + data, + ...result, + }; + } + + const textError = await response.text(); + let jsonError: unknown; + + try { + jsonError = JSON.parse(textError); + } catch { + // noop + } + + const error = jsonError ?? textError; + let finalError = error; + + for (const fn of interceptors.error.fns) { + if (fn) { + finalError = (await fn(error, response, request, opts)) as string; + } + } + + finalError = finalError || ({} as string); + + if (opts.throwOnError) { + throw finalError; + } + + // TODO: we probably want to return error and improve types + return opts.responseStyle === 'data' + ? undefined + : { + error: finalError, + ...result, + }; + }; + + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => + request({ ...options, method }); + + const makeSseFn = (method: Uppercase) => async (options: RequestOptions) => { + const { opts, url } = await beforeRequest(options); + return createSseClient({ + ...opts, + body: opts.body as BodyInit | null | undefined, + headers: opts.headers as unknown as Record, + method, + onRequest: async (url, init) => { + let request = new Request(url, init); + for (const fn of interceptors.request.fns) { + if (fn) { + request = await fn(request, opts); + } + } + return request; + }, + serializedBody: getValidRequestBody(opts) as BodyInit | null | undefined, + url, + }); + }; + + return { + buildUrl, + connect: makeMethodFn('CONNECT'), + delete: makeMethodFn('DELETE'), + get: makeMethodFn('GET'), + getConfig, + head: makeMethodFn('HEAD'), + interceptors, + options: makeMethodFn('OPTIONS'), + patch: makeMethodFn('PATCH'), + post: makeMethodFn('POST'), + put: makeMethodFn('PUT'), + request, + setConfig, + sse: { + connect: makeSseFn('CONNECT'), + delete: makeSseFn('DELETE'), + get: makeSseFn('GET'), + head: makeSseFn('HEAD'), + options: makeSseFn('OPTIONS'), + patch: makeSseFn('PATCH'), + post: makeSseFn('POST'), + put: makeSseFn('PUT'), + trace: makeSseFn('TRACE'), + }, + trace: makeMethodFn('TRACE'), + } as Client; +}; diff --git a/vtex/server/generated/intelligent-search-api-v1/client/index.ts b/vtex/server/generated/intelligent-search-api-v1/client/index.ts new file mode 100644 index 00000000..b295edec --- /dev/null +++ b/vtex/server/generated/intelligent-search-api-v1/client/index.ts @@ -0,0 +1,25 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type { Auth } from '../core/auth.gen'; +export type { QuerySerializerOptions } from '../core/bodySerializer.gen'; +export { + formDataBodySerializer, + jsonBodySerializer, + urlSearchParamsBodySerializer, +} from '../core/bodySerializer.gen'; +export { buildClientParams } from '../core/params.gen'; +export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen'; +export { createClient } from './client.gen'; +export type { + Client, + ClientOptions, + Config, + CreateClientConfig, + Options, + RequestOptions, + RequestResult, + ResolvedRequestOptions, + ResponseStyle, + TDataShape, +} from './types.gen'; +export { createConfig, mergeHeaders } from './utils.gen'; diff --git a/vtex/server/generated/intelligent-search-api-v1/client/types.gen.ts b/vtex/server/generated/intelligent-search-api-v1/client/types.gen.ts new file mode 100644 index 00000000..cb6d0d54 --- /dev/null +++ b/vtex/server/generated/intelligent-search-api-v1/client/types.gen.ts @@ -0,0 +1,213 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Auth } from '../core/auth.gen'; +import type { + ServerSentEventsOptions, + ServerSentEventsResult, +} from '../core/serverSentEvents.gen'; +import type { Client as CoreClient, Config as CoreConfig } from '../core/types.gen'; +import type { Middleware } from './utils.gen'; + +export type ResponseStyle = 'data' | 'fields'; + +export interface Config + extends Omit, CoreConfig { + /** + * Base URL for all requests made by this client. + */ + baseUrl?: T['baseUrl']; + /** + * Fetch API implementation. You can use this option to provide a custom + * fetch instance. + * + * @default globalThis.fetch + */ + fetch?: typeof fetch; + /** + * Please don't use the Fetch client for Next.js applications. The `next` + * options won't have any effect. + * + * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead. + */ + next?: never; + /** + * Return the response data parsed in a specified format. By default, `auto` + * will infer the appropriate method from the `Content-Type` response header. + * You can override this behavior with any of the {@link Body} methods. + * Select `stream` if you don't want to parse response data at all. + * + * @default 'auto' + */ + parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text'; + /** + * Should we return only data or multiple fields (data, error, response, etc.)? + * + * @default 'fields' + */ + responseStyle?: ResponseStyle; + /** + * Throw an error instead of returning it in the response? + * + * @default false + */ + throwOnError?: T['throwOnError']; +} + +export interface RequestOptions< + TData = unknown, + TResponseStyle extends ResponseStyle = 'fields', + ThrowOnError extends boolean = boolean, + Url extends string = string, +> + extends + Config<{ + responseStyle: TResponseStyle; + throwOnError: ThrowOnError; + }>, + Pick< + ServerSentEventsOptions, + | 'onSseError' + | 'onSseEvent' + | 'sseDefaultRetryDelay' + | 'sseMaxRetryAttempts' + | 'sseMaxRetryDelay' + > { + /** + * Any body that you want to add to your request. + * + * {@link https://developer.mozilla.org/docs/Web/API/fetch#body} + */ + body?: unknown; + path?: Record; + query?: Record; + /** + * Security mechanism(s) to use for the request. + */ + security?: ReadonlyArray; + url: Url; +} + +export interface ResolvedRequestOptions< + TResponseStyle extends ResponseStyle = 'fields', + ThrowOnError extends boolean = boolean, + Url extends string = string, +> extends RequestOptions { + serializedBody?: string; +} + +export type RequestResult< + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = boolean, + TResponseStyle extends ResponseStyle = 'fields', +> = ThrowOnError extends true + ? Promise< + TResponseStyle extends 'data' + ? TData extends Record + ? TData[keyof TData] + : TData + : { + data: TData extends Record ? TData[keyof TData] : TData; + request: Request; + response: Response; + } + > + : Promise< + TResponseStyle extends 'data' + ? (TData extends Record ? TData[keyof TData] : TData) | undefined + : ( + | { + data: TData extends Record ? TData[keyof TData] : TData; + error: undefined; + } + | { + data: undefined; + error: TError extends Record ? TError[keyof TError] : TError; + } + ) & { + request: Request; + response: Response; + } + >; + +export interface ClientOptions { + baseUrl?: string; + responseStyle?: ResponseStyle; + throwOnError?: boolean; +} + +type MethodFn = < + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = false, + TResponseStyle extends ResponseStyle = 'fields', +>( + options: Omit, 'method'>, +) => RequestResult; + +type SseFn = < + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = false, + TResponseStyle extends ResponseStyle = 'fields', +>( + options: Omit, 'method'>, +) => Promise>; + +type RequestFn = < + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = false, + TResponseStyle extends ResponseStyle = 'fields', +>( + options: Omit, 'method'> & + Pick>, 'method'>, +) => RequestResult; + +type BuildUrlFn = < + TData extends { + body?: unknown; + path?: Record; + query?: Record; + url: string; + }, +>( + options: TData & Options, +) => string; + +export type Client = CoreClient & { + interceptors: Middleware; +}; + +/** + * The `createClientConfig()` function will be called on client initialization + * and the returned object will become the client's initial configuration. + * + * You may want to initialize your client this way instead of calling + * `setConfig()`. This is useful for example if you're using Next.js + * to ensure your client always has the correct values. + */ +export type CreateClientConfig = ( + override?: Config, +) => Config & T>; + +export interface TDataShape { + body?: unknown; + headers?: unknown; + path?: unknown; + query?: unknown; + url: string; +} + +type OmitKeys = Pick>; + +export type Options< + TData extends TDataShape = TDataShape, + ThrowOnError extends boolean = boolean, + TResponse = unknown, + TResponseStyle extends ResponseStyle = 'fields', +> = OmitKeys< + RequestOptions, + 'body' | 'path' | 'query' | 'url' +> & + ([TData] extends [never] ? unknown : Omit); diff --git a/vtex/server/generated/intelligent-search-api-v1/client/utils.gen.ts b/vtex/server/generated/intelligent-search-api-v1/client/utils.gen.ts new file mode 100644 index 00000000..b4bd2435 --- /dev/null +++ b/vtex/server/generated/intelligent-search-api-v1/client/utils.gen.ts @@ -0,0 +1,316 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { getAuthToken } from '../core/auth.gen'; +import type { QuerySerializerOptions } from '../core/bodySerializer.gen'; +import { jsonBodySerializer } from '../core/bodySerializer.gen'; +import { + serializeArrayParam, + serializeObjectParam, + serializePrimitiveParam, +} from '../core/pathSerializer.gen'; +import { getUrl } from '../core/utils.gen'; +import type { Client, ClientOptions, Config, RequestOptions } from './types.gen'; + +export const createQuerySerializer = ({ + parameters = {}, + ...args +}: QuerySerializerOptions = {}) => { + const querySerializer = (queryParams: T) => { + const search: string[] = []; + if (queryParams && typeof queryParams === 'object') { + for (const name in queryParams) { + const value = queryParams[name]; + + if (value === undefined || value === null) { + continue; + } + + const options = parameters[name] || args; + + if (Array.isArray(value)) { + const serializedArray = serializeArrayParam({ + allowReserved: options.allowReserved, + explode: true, + name, + style: 'form', + value, + ...options.array, + }); + if (serializedArray) search.push(serializedArray); + } else if (typeof value === 'object') { + const serializedObject = serializeObjectParam({ + allowReserved: options.allowReserved, + explode: true, + name, + style: 'deepObject', + value: value as Record, + ...options.object, + }); + if (serializedObject) search.push(serializedObject); + } else { + const serializedPrimitive = serializePrimitiveParam({ + allowReserved: options.allowReserved, + name, + value: value as string, + }); + if (serializedPrimitive) search.push(serializedPrimitive); + } + } + } + return search.join('&'); + }; + return querySerializer; +}; + +/** + * Infers parseAs value from provided Content-Type header. + */ +export const getParseAs = (contentType: string | null): Exclude => { + if (!contentType) { + // If no Content-Type header is provided, the best we can do is return the raw response body, + // which is effectively the same as the 'stream' option. + return 'stream'; + } + + const cleanContent = contentType.split(';')[0]?.trim(); + + if (!cleanContent) { + return; + } + + if (cleanContent.startsWith('application/json') || cleanContent.endsWith('+json')) { + return 'json'; + } + + if (cleanContent === 'multipart/form-data') { + return 'formData'; + } + + if ( + ['application/', 'audio/', 'image/', 'video/'].some((type) => cleanContent.startsWith(type)) + ) { + return 'blob'; + } + + if (cleanContent.startsWith('text/')) { + return 'text'; + } + + return; +}; + +const checkForExistence = ( + options: Pick & { + headers: Headers; + }, + name?: string, +): boolean => { + if (!name) { + return false; + } + if ( + options.headers.has(name) || + options.query?.[name] || + options.headers.get('Cookie')?.includes(`${name}=`) + ) { + return true; + } + return false; +}; + +export const setAuthParams = async ({ + security, + ...options +}: Pick, 'security'> & + Pick & { + headers: Headers; + }) => { + for (const auth of security) { + if (checkForExistence(options, auth.name)) { + continue; + } + + const token = await getAuthToken(auth, options.auth); + + if (!token) { + continue; + } + + const name = auth.name ?? 'Authorization'; + + switch (auth.in) { + case 'query': + if (!options.query) { + options.query = {}; + } + options.query[name] = token; + break; + case 'cookie': + options.headers.append('Cookie', `${name}=${token}`); + break; + case 'header': + default: + options.headers.set(name, token); + break; + } + } +}; + +export const buildUrl: Client['buildUrl'] = (options) => + getUrl({ + baseUrl: options.baseUrl as string, + path: options.path, + query: options.query, + querySerializer: + typeof options.querySerializer === 'function' + ? options.querySerializer + : createQuerySerializer(options.querySerializer), + url: options.url, + }); + +export const mergeConfigs = (a: Config, b: Config): Config => { + const config = { ...a, ...b }; + if (config.baseUrl?.endsWith('/')) { + config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1); + } + config.headers = mergeHeaders(a.headers, b.headers); + return config; +}; + +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + +export const mergeHeaders = ( + ...headers: Array['headers'] | undefined> +): Headers => { + const mergedHeaders = new Headers(); + for (const header of headers) { + if (!header) { + continue; + } + + const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header); + + for (const [key, value] of iterator) { + if (value === null) { + mergedHeaders.delete(key); + } else if (Array.isArray(value)) { + for (const v of value) { + mergedHeaders.append(key, v as string); + } + } else if (value !== undefined) { + // assume object headers are meant to be JSON stringified, i.e. their + // content value in OpenAPI specification is 'application/json' + mergedHeaders.set( + key, + typeof value === 'object' ? JSON.stringify(value) : (value as string), + ); + } + } + } + return mergedHeaders; +}; + +type ErrInterceptor = ( + error: Err, + response: Res, + request: Req, + options: Options, +) => Err | Promise; + +type ReqInterceptor = (request: Req, options: Options) => Req | Promise; + +type ResInterceptor = ( + response: Res, + request: Req, + options: Options, +) => Res | Promise; + +class Interceptors { + fns: Array = []; + + clear(): void { + this.fns = []; + } + + eject(id: number | Interceptor): void { + const index = this.getInterceptorIndex(id); + if (this.fns[index]) { + this.fns[index] = null; + } + } + + exists(id: number | Interceptor): boolean { + const index = this.getInterceptorIndex(id); + return Boolean(this.fns[index]); + } + + getInterceptorIndex(id: number | Interceptor): number { + if (typeof id === 'number') { + return this.fns[id] ? id : -1; + } + return this.fns.indexOf(id); + } + + update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false { + const index = this.getInterceptorIndex(id); + if (this.fns[index]) { + this.fns[index] = fn; + return id; + } + return false; + } + + use(fn: Interceptor): number { + this.fns.push(fn); + return this.fns.length - 1; + } +} + +export interface Middleware { + error: Interceptors>; + request: Interceptors>; + response: Interceptors>; +} + +export const createInterceptors = (): Middleware< + Req, + Res, + Err, + Options +> => ({ + error: new Interceptors>(), + request: new Interceptors>(), + response: new Interceptors>(), +}); + +const defaultQuerySerializer = createQuerySerializer({ + allowReserved: false, + array: { + explode: true, + style: 'form', + }, + object: { + explode: true, + style: 'deepObject', + }, +}); + +const defaultHeaders = { + 'Content-Type': 'application/json', +}; + +export const createConfig = ( + override: Config & T> = {}, +): Config & T> => ({ + ...jsonBodySerializer, + headers: defaultHeaders, + parseAs: 'auto', + querySerializer: defaultQuerySerializer, + ...override, +}); diff --git a/vtex/server/generated/intelligent-search-api-v1/core/auth.gen.ts b/vtex/server/generated/intelligent-search-api-v1/core/auth.gen.ts new file mode 100644 index 00000000..3ebf9947 --- /dev/null +++ b/vtex/server/generated/intelligent-search-api-v1/core/auth.gen.ts @@ -0,0 +1,41 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type AuthToken = string | undefined; + +export interface Auth { + /** + * Which part of the request do we use to send the auth? + * + * @default 'header' + */ + in?: 'header' | 'query' | 'cookie'; + /** + * Header or query parameter name. + * + * @default 'Authorization' + */ + name?: string; + scheme?: 'basic' | 'bearer'; + type: 'apiKey' | 'http'; +} + +export const getAuthToken = async ( + auth: Auth, + callback: ((auth: Auth) => Promise | AuthToken) | AuthToken, +): Promise => { + const token = typeof callback === 'function' ? await callback(auth) : callback; + + if (!token) { + return; + } + + if (auth.scheme === 'bearer') { + return `Bearer ${token}`; + } + + if (auth.scheme === 'basic') { + return `Basic ${btoa(token)}`; + } + + return token; +}; diff --git a/vtex/server/generated/intelligent-search-api-v1/core/bodySerializer.gen.ts b/vtex/server/generated/intelligent-search-api-v1/core/bodySerializer.gen.ts new file mode 100644 index 00000000..8ad92c9f --- /dev/null +++ b/vtex/server/generated/intelligent-search-api-v1/core/bodySerializer.gen.ts @@ -0,0 +1,84 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { ArrayStyle, ObjectStyle, SerializerOptions } from './pathSerializer.gen'; + +export type QuerySerializer = (query: Record) => string; + +export type BodySerializer = (body: any) => any; + +type QuerySerializerOptionsObject = { + allowReserved?: boolean; + array?: Partial>; + object?: Partial>; +}; + +export type QuerySerializerOptions = QuerySerializerOptionsObject & { + /** + * Per-parameter serialization overrides. When provided, these settings + * override the global array/object settings for specific parameter names. + */ + parameters?: Record; +}; + +const serializeFormDataPair = (data: FormData, key: string, value: unknown): void => { + if (typeof value === 'string' || value instanceof Blob) { + data.append(key, value); + } else if (value instanceof Date) { + data.append(key, value.toISOString()); + } else { + data.append(key, JSON.stringify(value)); + } +}; + +const serializeUrlSearchParamsPair = (data: URLSearchParams, key: string, value: unknown): void => { + if (typeof value === 'string') { + data.append(key, value); + } else { + data.append(key, JSON.stringify(value)); + } +}; + +export const formDataBodySerializer = { + bodySerializer: | Array>>( + body: T, + ): FormData => { + const data = new FormData(); + + Object.entries(body).forEach(([key, value]) => { + if (value === undefined || value === null) { + return; + } + if (Array.isArray(value)) { + value.forEach((v) => serializeFormDataPair(data, key, v)); + } else { + serializeFormDataPair(data, key, value); + } + }); + + return data; + }, +}; + +export const jsonBodySerializer = { + bodySerializer: (body: T): string => + JSON.stringify(body, (_key, value) => (typeof value === 'bigint' ? value.toString() : value)), +}; + +export const urlSearchParamsBodySerializer = { + bodySerializer: | Array>>(body: T): string => { + const data = new URLSearchParams(); + + Object.entries(body).forEach(([key, value]) => { + if (value === undefined || value === null) { + return; + } + if (Array.isArray(value)) { + value.forEach((v) => serializeUrlSearchParamsPair(data, key, v)); + } else { + serializeUrlSearchParamsPair(data, key, value); + } + }); + + return data.toString(); + }, +}; diff --git a/vtex/server/generated/intelligent-search-api-v1/core/params.gen.ts b/vtex/server/generated/intelligent-search-api-v1/core/params.gen.ts new file mode 100644 index 00000000..6099cab1 --- /dev/null +++ b/vtex/server/generated/intelligent-search-api-v1/core/params.gen.ts @@ -0,0 +1,169 @@ +// This file is auto-generated by @hey-api/openapi-ts + +type Slot = 'body' | 'headers' | 'path' | 'query'; + +export type Field = + | { + in: Exclude; + /** + * Field name. This is the name we want the user to see and use. + */ + key: string; + /** + * Field mapped name. This is the name we want to use in the request. + * If omitted, we use the same value as `key`. + */ + map?: string; + } + | { + in: Extract; + /** + * Key isn't required for bodies. + */ + key?: string; + map?: string; + } + | { + /** + * Field name. This is the name we want the user to see and use. + */ + key: string; + /** + * Field mapped name. This is the name we want to use in the request. + * If `in` is omitted, `map` aliases `key` to the transport layer. + */ + map: Slot; + }; + +export interface Fields { + allowExtra?: Partial>; + args?: ReadonlyArray; +} + +export type FieldsConfig = ReadonlyArray; + +const extraPrefixesMap: Record = { + $body_: 'body', + $headers_: 'headers', + $path_: 'path', + $query_: 'query', +}; +const extraPrefixes = Object.entries(extraPrefixesMap); + +type KeyMap = Map< + string, + | { + in: Slot; + map?: string; + } + | { + in?: never; + map: Slot; + } +>; + +const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { + if (!map) { + map = new Map(); + } + + for (const config of fields) { + if ('in' in config) { + if (config.key) { + map.set(config.key, { + in: config.in, + map: config.map, + }); + } + } else if ('key' in config) { + map.set(config.key, { + map: config.map, + }); + } else if (config.args) { + buildKeyMap(config.args, map); + } + } + + return map; +}; + +interface Params { + body: unknown; + headers: Record; + path: Record; + query: Record; +} + +const stripEmptySlots = (params: Params) => { + for (const [slot, value] of Object.entries(params)) { + if (value && typeof value === 'object' && !Object.keys(value).length) { + delete params[slot as Slot]; + } + } +}; + +export const buildClientParams = (args: ReadonlyArray, fields: FieldsConfig) => { + const params: Params = { + body: {}, + headers: {}, + path: {}, + query: {}, + }; + + const map = buildKeyMap(fields); + + let config: FieldsConfig[number] | undefined; + + for (const [index, arg] of args.entries()) { + if (fields[index]) { + config = fields[index]; + } + + if (!config) { + continue; + } + + if ('in' in config) { + if (config.key) { + const field = map.get(config.key)!; + const name = field.map || config.key; + if (field.in) { + (params[field.in] as Record)[name] = arg; + } + } else { + params.body = arg; + } + } else { + for (const [key, value] of Object.entries(arg ?? {})) { + const field = map.get(key); + + if (field) { + if (field.in) { + const name = field.map || key; + (params[field.in] as Record)[name] = value; + } else { + params[field.map] = value; + } + } else { + const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix)); + + if (extra) { + const [prefix, slot] = extra; + (params[slot] as Record)[key.slice(prefix.length)] = value; + } else if ('allowExtra' in config && config.allowExtra) { + for (const [slot, allowed] of Object.entries(config.allowExtra)) { + if (allowed) { + (params[slot as Slot] as Record)[key] = value; + break; + } + } + } + } + } + } + } + + stripEmptySlots(params); + + return params; +}; diff --git a/vtex/server/generated/intelligent-search-api-v1/core/pathSerializer.gen.ts b/vtex/server/generated/intelligent-search-api-v1/core/pathSerializer.gen.ts new file mode 100644 index 00000000..994b2848 --- /dev/null +++ b/vtex/server/generated/intelligent-search-api-v1/core/pathSerializer.gen.ts @@ -0,0 +1,171 @@ +// This file is auto-generated by @hey-api/openapi-ts + +interface SerializeOptions extends SerializePrimitiveOptions, SerializerOptions {} + +interface SerializePrimitiveOptions { + allowReserved?: boolean; + name: string; +} + +export interface SerializerOptions { + /** + * @default true + */ + explode: boolean; + style: T; +} + +export type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited'; +export type ArraySeparatorStyle = ArrayStyle | MatrixStyle; +type MatrixStyle = 'label' | 'matrix' | 'simple'; +export type ObjectStyle = 'form' | 'deepObject'; +type ObjectSeparatorStyle = ObjectStyle | MatrixStyle; + +interface SerializePrimitiveParam extends SerializePrimitiveOptions { + value: string; +} + +export const separatorArrayExplode = (style: ArraySeparatorStyle) => { + switch (style) { + case 'label': + return '.'; + case 'matrix': + return ';'; + case 'simple': + return ','; + default: + return '&'; + } +}; + +export const separatorArrayNoExplode = (style: ArraySeparatorStyle) => { + switch (style) { + case 'form': + return ','; + case 'pipeDelimited': + return '|'; + case 'spaceDelimited': + return '%20'; + default: + return ','; + } +}; + +export const separatorObjectExplode = (style: ObjectSeparatorStyle) => { + switch (style) { + case 'label': + return '.'; + case 'matrix': + return ';'; + case 'simple': + return ','; + default: + return '&'; + } +}; + +export const serializeArrayParam = ({ + allowReserved, + explode, + name, + style, + value, +}: SerializeOptions & { + value: unknown[]; +}) => { + if (!explode) { + const joinedValues = ( + allowReserved ? value : value.map((v) => encodeURIComponent(v as string)) + ).join(separatorArrayNoExplode(style)); + switch (style) { + case 'label': + return `.${joinedValues}`; + case 'matrix': + return `;${name}=${joinedValues}`; + case 'simple': + return joinedValues; + default: + return `${name}=${joinedValues}`; + } + } + + const separator = separatorArrayExplode(style); + const joinedValues = value + .map((v) => { + if (style === 'label' || style === 'simple') { + return allowReserved ? v : encodeURIComponent(v as string); + } + + return serializePrimitiveParam({ + allowReserved, + name, + value: v as string, + }); + }) + .join(separator); + return style === 'label' || style === 'matrix' ? separator + joinedValues : joinedValues; +}; + +export const serializePrimitiveParam = ({ + allowReserved, + name, + value, +}: SerializePrimitiveParam) => { + if (value === undefined || value === null) { + return ''; + } + + if (typeof value === 'object') { + throw new Error( + 'Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.', + ); + } + + return `${name}=${allowReserved ? value : encodeURIComponent(value)}`; +}; + +export const serializeObjectParam = ({ + allowReserved, + explode, + name, + style, + value, + valueOnly, +}: SerializeOptions & { + value: Record | Date; + valueOnly?: boolean; +}) => { + if (value instanceof Date) { + return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`; + } + + if (style !== 'deepObject' && !explode) { + let values: string[] = []; + Object.entries(value).forEach(([key, v]) => { + values = [...values, key, allowReserved ? (v as string) : encodeURIComponent(v as string)]; + }); + const joinedValues = values.join(','); + switch (style) { + case 'form': + return `${name}=${joinedValues}`; + case 'label': + return `.${joinedValues}`; + case 'matrix': + return `;${name}=${joinedValues}`; + default: + return joinedValues; + } + } + + const separator = separatorObjectExplode(style); + const joinedValues = Object.entries(value) + .map(([key, v]) => + serializePrimitiveParam({ + allowReserved, + name: style === 'deepObject' ? `${name}[${key}]` : key, + value: v as string, + }), + ) + .join(separator); + return style === 'label' || style === 'matrix' ? separator + joinedValues : joinedValues; +}; diff --git a/vtex/server/generated/intelligent-search-api-v1/core/queryKeySerializer.gen.ts b/vtex/server/generated/intelligent-search-api-v1/core/queryKeySerializer.gen.ts new file mode 100644 index 00000000..5000df60 --- /dev/null +++ b/vtex/server/generated/intelligent-search-api-v1/core/queryKeySerializer.gen.ts @@ -0,0 +1,117 @@ +// This file is auto-generated by @hey-api/openapi-ts + +/** + * JSON-friendly union that mirrors what Pinia Colada can hash. + */ +export type JsonValue = + | null + | string + | number + | boolean + | JsonValue[] + | { [key: string]: JsonValue }; + +/** + * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes. + */ +export const queryKeyJsonReplacer = (_key: string, value: unknown) => { + if (value === undefined || typeof value === 'function' || typeof value === 'symbol') { + return undefined; + } + if (typeof value === 'bigint') { + return value.toString(); + } + if (value instanceof Date) { + return value.toISOString(); + } + return value; +}; + +/** + * Safely stringifies a value and parses it back into a JsonValue. + */ +export const stringifyToJsonValue = (input: unknown): JsonValue | undefined => { + try { + const json = JSON.stringify(input, queryKeyJsonReplacer); + if (json === undefined) { + return undefined; + } + return JSON.parse(json) as JsonValue; + } catch { + return undefined; + } +}; + +/** + * Detects plain objects (including objects with a null prototype). + */ +const isPlainObject = (value: unknown): value is Record => { + if (value === null || typeof value !== 'object') { + return false; + } + const prototype = Object.getPrototypeOf(value as object); + return prototype === Object.prototype || prototype === null; +}; + +/** + * Turns URLSearchParams into a sorted JSON object for deterministic keys. + */ +const serializeSearchParams = (params: URLSearchParams): JsonValue => { + const entries = Array.from(params.entries()).sort(([a], [b]) => a.localeCompare(b)); + const result: Record = {}; + + for (const [key, value] of entries) { + const existing = result[key]; + if (existing === undefined) { + result[key] = value; + continue; + } + + if (Array.isArray(existing)) { + (existing as string[]).push(value); + } else { + result[key] = [existing, value]; + } + } + + return result; +}; + +/** + * Normalizes any accepted value into a JSON-friendly shape for query keys. + */ +export const serializeQueryKeyValue = (value: unknown): JsonValue | undefined => { + if (value === null) { + return null; + } + + if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { + return value; + } + + if (value === undefined || typeof value === 'function' || typeof value === 'symbol') { + return undefined; + } + + if (typeof value === 'bigint') { + return value.toString(); + } + + if (value instanceof Date) { + return value.toISOString(); + } + + if (Array.isArray(value)) { + return stringifyToJsonValue(value); + } + + if (typeof URLSearchParams !== 'undefined' && value instanceof URLSearchParams) { + return serializeSearchParams(value); + } + + if (isPlainObject(value)) { + return stringifyToJsonValue(value); + } + + return undefined; +}; diff --git a/vtex/server/generated/intelligent-search-api-v1/core/serverSentEvents.gen.ts b/vtex/server/generated/intelligent-search-api-v1/core/serverSentEvents.gen.ts new file mode 100644 index 00000000..6aa6cf02 --- /dev/null +++ b/vtex/server/generated/intelligent-search-api-v1/core/serverSentEvents.gen.ts @@ -0,0 +1,243 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Config } from './types.gen'; + +export type ServerSentEventsOptions = Omit & + Pick & { + /** + * Fetch API implementation. You can use this option to provide a custom + * fetch instance. + * + * @default globalThis.fetch + */ + fetch?: typeof fetch; + /** + * Implementing clients can call request interceptors inside this hook. + */ + onRequest?: (url: string, init: RequestInit) => Promise; + /** + * Callback invoked when a network or parsing error occurs during streaming. + * + * This option applies only if the endpoint returns a stream of events. + * + * @param error The error that occurred. + */ + onSseError?: (error: unknown) => void; + /** + * Callback invoked when an event is streamed from the server. + * + * This option applies only if the endpoint returns a stream of events. + * + * @param event Event streamed from the server. + * @returns Nothing (void). + */ + onSseEvent?: (event: StreamEvent) => void; + serializedBody?: RequestInit['body']; + /** + * Default retry delay in milliseconds. + * + * This option applies only if the endpoint returns a stream of events. + * + * @default 3000 + */ + sseDefaultRetryDelay?: number; + /** + * Maximum number of retry attempts before giving up. + */ + sseMaxRetryAttempts?: number; + /** + * Maximum retry delay in milliseconds. + * + * Applies only when exponential backoff is used. + * + * This option applies only if the endpoint returns a stream of events. + * + * @default 30000 + */ + sseMaxRetryDelay?: number; + /** + * Optional sleep function for retry backoff. + * + * Defaults to using `setTimeout`. + */ + sseSleepFn?: (ms: number) => Promise; + url: string; + }; + +export interface StreamEvent { + data: TData; + event?: string; + id?: string; + retry?: number; +} + +export type ServerSentEventsResult = { + stream: AsyncGenerator< + TData extends Record ? TData[keyof TData] : TData, + TReturn, + TNext + >; +}; + +export const createSseClient = ({ + onRequest, + onSseError, + onSseEvent, + responseTransformer, + responseValidator, + sseDefaultRetryDelay, + sseMaxRetryAttempts, + sseMaxRetryDelay, + sseSleepFn, + url, + ...options +}: ServerSentEventsOptions): ServerSentEventsResult => { + let lastEventId: string | undefined; + + const sleep = sseSleepFn ?? ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms))); + + const createStream = async function* () { + let retryDelay: number = sseDefaultRetryDelay ?? 3000; + let attempt = 0; + const signal = options.signal ?? new AbortController().signal; + + while (true) { + if (signal.aborted) break; + + attempt++; + + const headers = + options.headers instanceof Headers + ? options.headers + : new Headers(options.headers as Record | undefined); + + if (lastEventId !== undefined) { + headers.set('Last-Event-ID', lastEventId); + } + + try { + const requestInit: RequestInit = { + redirect: 'follow', + ...options, + body: options.serializedBody, + headers, + signal, + }; + let request = new Request(url, requestInit); + if (onRequest) { + request = await onRequest(url, requestInit); + } + // fetch must be assigned here, otherwise it would throw the error: + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation + const _fetch = options.fetch ?? globalThis.fetch; + const response = await _fetch(request); + + if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`); + + if (!response.body) throw new Error('No body in SSE response'); + + const reader = response.body.pipeThrough(new TextDecoderStream()).getReader(); + + let buffer = ''; + + const abortHandler = () => { + try { + reader.cancel(); + } catch { + // noop + } + }; + + signal.addEventListener('abort', abortHandler); + + try { + while (true) { + const { done, value } = await reader.read(); + if (done) break; + buffer += value; + // Normalize line endings: CRLF -> LF, then CR -> LF + buffer = buffer.replace(/\r\n/g, '\n').replace(/\r/g, '\n'); + + const chunks = buffer.split('\n\n'); + buffer = chunks.pop() ?? ''; + + for (const chunk of chunks) { + const lines = chunk.split('\n'); + const dataLines: Array = []; + let eventName: string | undefined; + + for (const line of lines) { + if (line.startsWith('data:')) { + dataLines.push(line.replace(/^data:\s*/, '')); + } else if (line.startsWith('event:')) { + eventName = line.replace(/^event:\s*/, ''); + } else if (line.startsWith('id:')) { + lastEventId = line.replace(/^id:\s*/, ''); + } else if (line.startsWith('retry:')) { + const parsed = Number.parseInt(line.replace(/^retry:\s*/, ''), 10); + if (!Number.isNaN(parsed)) { + retryDelay = parsed; + } + } + } + + let data: unknown; + let parsedJson = false; + + if (dataLines.length) { + const rawData = dataLines.join('\n'); + try { + data = JSON.parse(rawData); + parsedJson = true; + } catch { + data = rawData; + } + } + + if (parsedJson) { + if (responseValidator) { + await responseValidator(data); + } + + if (responseTransformer) { + data = await responseTransformer(data); + } + } + + onSseEvent?.({ + data, + event: eventName, + id: lastEventId, + retry: retryDelay, + }); + + if (dataLines.length) { + yield data as any; + } + } + } + } finally { + signal.removeEventListener('abort', abortHandler); + reader.releaseLock(); + } + + break; // exit loop on normal completion + } catch (error) { + // connection failed or aborted; retry after delay + onSseError?.(error); + + if (sseMaxRetryAttempts !== undefined && attempt >= sseMaxRetryAttempts) { + break; // stop after firing error + } + + // exponential backoff: double retry each attempt, cap at 30s + const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 30000); + await sleep(backoff); + } + } + }; + + const stream = createStream(); + + return { stream }; +}; diff --git a/vtex/server/generated/intelligent-search-api-v1/core/types.gen.ts b/vtex/server/generated/intelligent-search-api-v1/core/types.gen.ts new file mode 100644 index 00000000..97463257 --- /dev/null +++ b/vtex/server/generated/intelligent-search-api-v1/core/types.gen.ts @@ -0,0 +1,104 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Auth, AuthToken } from './auth.gen'; +import type { BodySerializer, QuerySerializer, QuerySerializerOptions } from './bodySerializer.gen'; + +export type HttpMethod = + | 'connect' + | 'delete' + | 'get' + | 'head' + | 'options' + | 'patch' + | 'post' + | 'put' + | 'trace'; + +export type Client< + RequestFn = never, + Config = unknown, + MethodFn = never, + BuildUrlFn = never, + SseFn = never, +> = { + /** + * Returns the final request URL. + */ + buildUrl: BuildUrlFn; + getConfig: () => Config; + request: RequestFn; + setConfig: (config: Config) => Config; +} & { + [K in HttpMethod]: MethodFn; +} & ([SseFn] extends [never] ? { sse?: never } : { sse: { [K in HttpMethod]: SseFn } }); + +export interface Config { + /** + * Auth token or a function returning auth token. The resolved value will be + * added to the request payload as defined by its `security` array. + */ + auth?: ((auth: Auth) => Promise | AuthToken) | AuthToken; + /** + * A function for serializing request body parameter. By default, + * {@link JSON.stringify()} will be used. + */ + bodySerializer?: BodySerializer | null; + /** + * An object containing any HTTP headers that you want to pre-populate your + * `Headers` object with. + * + * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more} + */ + headers?: + | RequestInit['headers'] + | Record< + string, + string | number | boolean | (string | number | boolean)[] | null | undefined | unknown + >; + /** + * The request method. + * + * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more} + */ + method?: Uppercase; + /** + * A function for serializing request query parameters. By default, arrays + * will be exploded in form style, objects will be exploded in deepObject + * style, and reserved characters are percent-encoded. + * + * This method will have no effect if the native `paramsSerializer()` Axios + * API function is used. + * + * {@link https://swagger.io/docs/specification/serialization/#query View examples} + */ + querySerializer?: QuerySerializer | QuerySerializerOptions; + /** + * A function validating request data. This is useful if you want to ensure + * the request conforms to the desired shape, so it can be safely sent to + * the server. + */ + requestValidator?: (data: unknown) => Promise; + /** + * A function transforming response data before it's returned. This is useful + * for post-processing data, e.g. converting ISO strings into Date objects. + */ + responseTransformer?: (data: unknown) => Promise; + /** + * A function validating response data. This is useful if you want to ensure + * the response conforms to the desired shape, so it can be safely passed to + * the transformers and returned to the user. + */ + responseValidator?: (data: unknown) => Promise; +} + +type IsExactlyNeverOrNeverUndefined = [T] extends [never] + ? true + : [T] extends [never | undefined] + ? [undefined] extends [T] + ? false + : true + : false; + +export type OmitNever> = { + [K in keyof T as IsExactlyNeverOrNeverUndefined extends true ? never : K]: T[K]; +}; diff --git a/vtex/server/generated/intelligent-search-api-v1/core/utils.gen.ts b/vtex/server/generated/intelligent-search-api-v1/core/utils.gen.ts new file mode 100644 index 00000000..e7ddbe35 --- /dev/null +++ b/vtex/server/generated/intelligent-search-api-v1/core/utils.gen.ts @@ -0,0 +1,140 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; +import { + type ArraySeparatorStyle, + serializeArrayParam, + serializeObjectParam, + serializePrimitiveParam, +} from './pathSerializer.gen'; + +export interface PathSerializer { + path: Record; + url: string; +} + +export const PATH_PARAM_RE = /\{[^{}]+\}/g; + +export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { + let url = _url; + const matches = _url.match(PATH_PARAM_RE); + if (matches) { + for (const match of matches) { + let explode = false; + let name = match.substring(1, match.length - 1); + let style: ArraySeparatorStyle = 'simple'; + + if (name.endsWith('*')) { + explode = true; + name = name.substring(0, name.length - 1); + } + + if (name.startsWith('.')) { + name = name.substring(1); + style = 'label'; + } else if (name.startsWith(';')) { + name = name.substring(1); + style = 'matrix'; + } + + const value = path[name]; + + if (value === undefined || value === null) { + continue; + } + + if (Array.isArray(value)) { + url = url.replace(match, serializeArrayParam({ explode, name, style, value })); + continue; + } + + if (typeof value === 'object') { + url = url.replace( + match, + serializeObjectParam({ + explode, + name, + style, + value: value as Record, + valueOnly: true, + }), + ); + continue; + } + + if (style === 'matrix') { + url = url.replace( + match, + `;${serializePrimitiveParam({ + name, + value: value as string, + })}`, + ); + continue; + } + + const replaceValue = encodeURIComponent( + style === 'label' ? `.${value as string}` : (value as string), + ); + url = url.replace(match, replaceValue); + } + } + return url; +}; + +export const getUrl = ({ + baseUrl, + path, + query, + querySerializer, + url: _url, +}: { + baseUrl?: string; + path?: Record; + query?: Record; + querySerializer: QuerySerializer; + url: string; +}) => { + const pathUrl = _url.startsWith('/') ? _url : `/${_url}`; + let url = (baseUrl ?? '') + pathUrl; + if (path) { + url = defaultPathSerializer({ path, url }); + } + let search = query ? querySerializer(query) : ''; + if (search.startsWith('?')) { + search = search.substring(1); + } + if (search) { + url += `?${search}`; + } + return url; +}; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // not all clients implement a serializedBody property (i.e. client-axios) + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/vtex/server/generated/intelligent-search-api-v1/index.ts b/vtex/server/generated/intelligent-search-api-v1/index.ts new file mode 100644 index 00000000..7f356512 --- /dev/null +++ b/vtex/server/generated/intelligent-search-api-v1/index.ts @@ -0,0 +1,4 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export { getAutocompleteSuggestions, getBannersByFacets, getCorrectionSearch, getFacetsByFacets, getPickupPointAvailabilityByFacets, getProducts, getProductSearchByFacets, getSearchSuggestions, getTopSearches, type Options } from './sdk.gen'; +export type { AdvertisementPlacement, AutocompleteSearchSuggestions, Banners, Campaigns, ClientOptions, Coordinates, Correction, Country, DeliveryZonesHash, ErrorResponse, Facets, FacetsPath, Fuzzy, GetAutocompleteSuggestionsData, GetAutocompleteSuggestionsErrors, GetAutocompleteSuggestionsResponse, GetAutocompleteSuggestionsResponses, GetBannersByFacetsData, GetBannersByFacetsErrors, GetBannersByFacetsResponse, GetBannersByFacetsResponses, GetCorrectionSearchData, GetCorrectionSearchErrors, GetCorrectionSearchResponse, GetCorrectionSearchResponses, GetFacetsByFacetsData, GetFacetsByFacetsResponse, GetFacetsByFacetsResponses, GetPickupPointAvailabilityByFacetsData, GetPickupPointAvailabilityByFacetsErrors, GetPickupPointAvailabilityByFacetsResponse, GetPickupPointAvailabilityByFacetsResponses, GetProductsData, GetProductSearchByFacetsData, GetProductSearchByFacetsError, GetProductSearchByFacetsErrors, GetProductSearchByFacetsResponse, GetProductSearchByFacetsResponses, GetProductsErrors, GetProductsResponse, GetProductsResponses, GetSearchSuggestionsData, GetSearchSuggestionsErrors, GetSearchSuggestionsResponse, GetSearchSuggestionsResponses, GetTopSearchesData, GetTopSearchesErrors, GetTopSearchesResponse, GetTopSearchesResponses, HideUnavailableItems, Locale, Operator, PickupPoint, PickupPointsHash, PriceTables, Product, ProductSearch, Query, RegionId, RepeatSponsoredProducts, Sc, SearchSuggestions, SimulationBehavior, SponsoredCount, TopSearches, UtmCampaign, UtmiCampaign, UtmSource, ZipCode } from './types.gen'; diff --git a/vtex/server/generated/intelligent-search-api-v1/sdk.gen.ts b/vtex/server/generated/intelligent-search-api-v1/sdk.gen.ts new file mode 100644 index 00000000..a52e2bf0 --- /dev/null +++ b/vtex/server/generated/intelligent-search-api-v1/sdk.gen.ts @@ -0,0 +1,526 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Client, Options as Options2, TDataShape } from './client'; +import { client } from './client.gen'; +import type { GetAutocompleteSuggestionsData, GetAutocompleteSuggestionsErrors, GetAutocompleteSuggestionsResponses, GetBannersByFacetsData, GetBannersByFacetsErrors, GetBannersByFacetsResponses, GetCorrectionSearchData, GetCorrectionSearchErrors, GetCorrectionSearchResponses, GetFacetsByFacetsData, GetFacetsByFacetsResponses, GetPickupPointAvailabilityByFacetsData, GetPickupPointAvailabilityByFacetsErrors, GetPickupPointAvailabilityByFacetsResponses, GetProductsData, GetProductSearchByFacetsData, GetProductSearchByFacetsErrors, GetProductSearchByFacetsResponses, GetProductsErrors, GetProductsResponses, GetSearchSuggestionsData, GetSearchSuggestionsErrors, GetSearchSuggestionsResponses, GetTopSearchesData, GetTopSearchesErrors, GetTopSearchesResponses } from './types.gen'; + +export type Options = Options2 & { + /** + * You can provide a client instance returned by `createClient()` instead of + * individual options. This might be also useful if you want to implement a + * custom client. + */ + client?: Client; + /** + * You can pass arbitrary values through the `meta` object. This can be + * used to access values that aren't defined as part of the SDK function. + */ + meta?: Record; +}; + +/** + * Get list of the 10 most searched terms + * + * Lists the 10 most searched terms in the past 14 days. + * + * For more information, check the Intelligent Search [Autocomplete](https://help.vtex.com/docs/tutorials/autocomplete) guide. + * + * >ℹ️ **Segment context:** Intelligent Search API (Legacy) previously read `locale` from `segment.cultureInfo` in the VTEX segment cookie. In v1, pass it directly as a query parameter. + * + * >ℹ️ **Caching:** Responses are cached for public sales channels. Always read the `Cache-Control` response header at runtime to determine cacheability. + * + * ## Permissions + * + * This endpoint does not require [authentication](https://developers.vtex.com/docs/guides/authentication) or [permissions](https://help.vtex.com/docs/tutorials/license-manager-resources). + */ +export const getTopSearches = (options?: Options) => (options?.client ?? client).get({ url: '/top-searches', ...options }); + +/** + * Get list of suggested terms and attributes similar to the search term + * + * Lists the suggested terms and attributes similar to the search term. + * + * For more information, check the Intelligent Search [Autocomplete](https://help.vtex.com/docs/tutorials/autocomplete) guide. + * + * >ℹ️ **Segment context:** Intelligent Search API (Legacy) previously read `locale` from `segment.cultureInfo` in the VTEX segment cookie. In v1, pass it directly as a query parameter. + * + * >ℹ️ **Caching:** Responses are cached for public sales channels. Always read the `Cache-Control` response header at runtime to determine cacheability. + * + * If `query` is missing or empty, the response is `{ "searches": [] }`. + * + * ## Permissions + * + * This endpoint does not require [authentication](https://developers.vtex.com/docs/guides/authentication) or [permissions](https://help.vtex.com/docs/tutorials/license-manager-resources). + */ +export const getAutocompleteSuggestions = (options?: Options) => (options?.client ?? client).get({ url: '/autocomplete-suggestions', ...options }); + +/** + * Get list of suggested terms similar to the search term + * + * Lists suggested terms similar to the search term. + * + * For more information, check the Intelligent Search [Autocomplete](https://help.vtex.com/docs/tutorials/autocomplete) guide. + * + * >ℹ️ **Segment context:** Intelligent Search API (Legacy) previously read `locale` from `segment.cultureInfo` in the VTEX segment cookie. In v1, pass it directly as a query parameter. + * + * >ℹ️ **Caching:** Responses are cached for public sales channels. Always read the `Cache-Control` response header at runtime to determine cacheability. + * + * If `query` is missing, empty, or whitespace-only, the response is `{ "searches": [] }`. + * + * ## Permissions + * + * This endpoint does not require [authentication](https://developers.vtex.com/docs/guides/authentication) or [permissions](https://help.vtex.com/docs/tutorials/license-manager-resources). + */ +export const getSearchSuggestions = (options?: Options) => (options?.client ?? client).get({ url: '/search-suggestions', ...options }); + +/** + * Get attempt of correction of a misspelled term + * + * Tries to correct a misspelled term from the search. + * + * >ℹ️ **Segment context:** Intelligent Search API (Legacy) previously read `locale` from `segment.cultureInfo` in the VTEX segment cookie. In v1, pass it directly as a query parameter. + * + * >ℹ️ **Caching:** Responses are cached for public sales channels. Always read the `Cache-Control` response header at runtime to determine cacheability. + * + * If `query` is missing, empty, or whitespace-only, the response is `{"correction": {"correction": false, "misspelled": false, "text": "", "highlighted": ""}}`. + * + * ## Permissions + * + * This endpoint does not require [authentication](https://developers.vtex.com/docs/guides/authentication) or [permissions](https://help.vtex.com/docs/tutorials/license-manager-resources). + */ +export const getCorrectionSearch = (options?: Options) => (options?.client ?? client).get({ url: '/correction-search', ...options }); + +/** + * Get list of banners registered for query + * + * Lists the banners registered for a given query. Check the [configuring banners documentation](https://help.vtex.com/en/tracks/vtex-intelligent-search--19wrbB7nEQcmwzDPl1l4Cb/4ViKEivLJtJsvpaW0aqIQ5) for a full explanation of the banner feature. + * + * >ℹ️ **Segment context:** Intelligent Search API (Legacy) previously read `locale` from `segment.cultureInfo` in the VTEX segment cookie. In v1, pass it directly as a query parameter. + * + * >ℹ️ **Caching:** Responses are cached for public sales channels. Always read the `Cache-Control` response header at runtime to determine cacheability. + * + * ## Permissions + * + * This endpoint does not require [authentication](https://developers.vtex.com/docs/guides/authentication) or [permissions](https://help.vtex.com/docs/tutorials/license-manager-resources). + */ +export const getBannersByFacets = (options: Options) => (options.client ?? client).get({ url: '/banners/{facets}', ...options }); + +/** + * Search products + * + * Lists the active products for a given query. + * + * >⚠️ **Fetching a single known product?** Use `GET` [Get product](https://developers.vtex.com/docs/api-reference/intelligent-search-api-v1#get-/products) instead. It skips the search pipeline (lower latency) and caches better. + * + * >ℹ️ **Caching:** Responses are cached for public sales channels. Always read the `Cache-Control` response header at runtime to determine cacheability. Responses containing sponsored products are not cached. + * + * >ℹ️ **Segment context:** Several parameters on this endpoint replace values previously read from the VTEX segment cookie. See [Migrating from segment](#migrating-from-segment) below. + * + * ## Migrating from segment + * + * Intelligent Search API (Legacy) reads the following values from the VTEX segment cookie. In v1, pass each one directly as a query parameter: + * + * | v1 parameter | Segment source | + * |:---|:---| + * | `locale` | `segment.cultureInfo` | + * | `sc` | `segment.channel` | + * | `regionId` | `segment.regionId` | + * | `country` | `segment.countryCode` or `country` key in `segment.facets` | + * | `zip-code` | `zip-code` key in `segment.facets` | + * | `coordinates` | `coordinates` key in `segment.facets` | + * | `pickupPoint` | `pickupPoint` key in `segment.facets` | + * | `deliveryZonesHash` | `deliveryZonesHash` key in `segment.facets` | + * | `pickupPointsHash` | `pickupPointsHash` key in `segment.facets` | + * | `utmSource` | `segment.utm_source` | + * | `utmCampaign` | `segment.utm_campaign` | + * | `utmiCampaign` | `segment.utmi_campaign` | + * | `campaigns` | `segment.campaigns` | + * | `priceTables` | `segment.priceTables` | + * + * All other keys in `segment.facets` must be appended to the URL path as `key/value` pairs. + * + *
+ * TypeScript reference implementation + * + * The following TypeScript snippet shows the full translation: + * + * ```typescript + * type Segment = { + * channel?: string | number + * regionId?: string + * countryCode?: string + * cultureInfo?: string + * // Semicolon-separated "key=value" string, e.g. "zip-code=22250-040;country=BRA" + * facets?: string + * utm_source?: string + * utm_campaign?: string + * utmi_campaign?: string + * campaigns?: string + * priceTables?: string + * } + * + * const SHIPPING_KEYS = new Set([ + * 'zip-code', 'coordinates', 'country', 'pickupPoint', + * 'deliveryZonesHash', 'pickupPointsHash', + * ]) + * + * function segmentToProductSearchV1(segment: Segment, query?: string): string { + * const shipping: Record = {} + * const pathFacets: Array<{ key: string; value: string }> = [] + * + * for (const pair of (segment.facets ?? '').split(';')) { + * const eq = pair.indexOf('=') + * if (eq < 0) continue + * const key = pair.slice(0, eq) + * const value = pair.slice(eq + 1) + * if (!key || !value) continue + * + * if (SHIPPING_KEYS.has(key)) { + * shipping[key] = value + * } else { + * pathFacets.push({ key, value }) + * } + * } + * + * const params: Record = {} + * const set = (name: string, value?: string | number) => { + * if (value !== undefined && value !== null && value !== '') { + * params[name] = String(value) + * } + * } + * + * set('sc', segment.channel) + * set('locale', segment.cultureInfo) + * set('regionId', segment.regionId) + * set('country', segment.countryCode ?? shipping.country) + * set('zip-code', shipping['zip-code']) + * set('coordinates', shipping.coordinates) + * set('pickupPoint', shipping.pickupPoint) + * set('deliveryZonesHash', shipping.deliveryZonesHash) + * set('pickupPointsHash', shipping.pickupPointsHash) + * set('utmSource', segment.utm_source) + * set('utmCampaign', segment.utm_campaign) + * set('utmiCampaign', segment.utmi_campaign) + * set('campaigns', segment.campaigns) + * set('priceTables', segment.priceTables) + * + * if (query) params.query = query + * + * const facetPath = pathFacets.map(f => `${f.key}/${f.value}`).join('/') + * const search = new URLSearchParams(params).toString() + * + * return `https://{accountName}.vtexcommercestable.com.br/api/intelligent-search/v1/product-search${facetPath ? `/${facetPath}` : ''}?${search}` + * } + * ``` + * + *
+ * + * ## Sponsored products (VTEX Ads) + * + * The query parameters **`showSponsored`**, **`sponsoredCount`**, **`advertisementPlacement`**, and **`repeatSponsoredProducts`** apply only to stores using [VTEX Ads](https://developers.vtex.com/docs/guides/vtex-ads). Sponsored products are merged into the `products` array. + * + * ## Permissions + * + * This endpoint does not require [authentication](https://developers.vtex.com/docs/guides/authentication) or [permissions](https://help.vtex.com/docs/tutorials/license-manager-resources). + */ +export const getProductSearchByFacets = (options: Options) => (options.client ?? client).get({ url: '/product-search/{facets}', ...options }); + +/** + * List filters for a search + * + * Lists the possible facets for a given query. + * + * >ℹ️ **Caching:** Responses are cached for public sales channels. Always read the `Cache-Control` response header at runtime to determine cacheability. + * + * >ℹ️ **Segment context:** Several parameters on this endpoint replace values previously read from the VTEX segment cookie. See [Migrating from segment](#migrating-from-segment) below. + * + * ## Migrating from segment + * + * Intelligent Search API (Legacy) reads the following values from the VTEX segment cookie. In v1, pass each one directly as a query parameter: + * + * | v1 parameter | Segment source | + * |:---|:---| + * | `locale` | `segment.cultureInfo` | + * | `sc` | `segment.channel` | + * | `regionId` | `segment.regionId` | + * | `country` | `segment.countryCode` or `country` key in `segment.facets` | + * | `zip-code` | `zip-code` key in `segment.facets` | + * | `coordinates` | `coordinates` key in `segment.facets` | + * | `pickupPoint` | `pickupPoint` key in `segment.facets` | + * | `deliveryZonesHash` | `deliveryZonesHash` key in `segment.facets` | + * | `pickupPointsHash` | `pickupPointsHash` key in `segment.facets` | + * + * All other keys in `segment.facets` must be appended to the URL path as `key/value` pairs. + * + *
+ * TypeScript reference implementation + * + * The following TypeScript snippet shows the full translation: + * + * ```typescript + * type Segment = { + * channel?: string | number + * regionId?: string + * countryCode?: string + * cultureInfo?: string + * // Semicolon-separated "key=value" string, e.g. "zip-code=22250-040;country=BRA;brand=acme" + * facets?: string + * } + * + * const SHIPPING_KEYS = new Set([ + * 'zip-code', 'coordinates', 'country', 'pickupPoint', + * 'deliveryZonesHash', 'pickupPointsHash', + * ]) + * + * function segmentToFacetsV1(segment: Segment, query?: string): string { + * const shipping: Record = {} + * const pathFacets: Array<{ key: string; value: string }> = [] + * + * for (const pair of (segment.facets ?? '').split(';')) { + * const eq = pair.indexOf('=') + * if (eq < 0) continue + * const key = pair.slice(0, eq) + * const value = pair.slice(eq + 1) + * if (!key || !value) continue + * + * if (SHIPPING_KEYS.has(key)) { + * shipping[key] = value + * } else { + * pathFacets.push({ key, value }) + * } + * } + * + * const params: Record = {} + * const set = (name: string, value?: string | number) => { + * if (value !== undefined && value !== null && value !== '') { + * params[name] = String(value) + * } + * } + * + * set('sc', segment.channel) + * set('locale', segment.cultureInfo) + * set('regionId', segment.regionId) + * set('country', segment.countryCode ?? shipping.country) + * set('zip-code', shipping['zip-code']) + * set('coordinates', shipping.coordinates) + * set('pickupPoint', shipping.pickupPoint) + * set('deliveryZonesHash', shipping.deliveryZonesHash) + * set('pickupPointsHash', shipping.pickupPointsHash) + * + * if (query) params.query = query + * + * const facetPath = pathFacets.map(f => `${f.key}/${f.value}`).join('/') + * const search = new URLSearchParams(params).toString() + * + * return `https://{accountName}.vtexcommercestable.com.br/api/intelligent-search/v1/facets${facetPath ? `/${facetPath}` : ''}?${search}` + * } + * ``` + * + *
+ * + * ## Permissions + * + * This endpoint does not require [authentication](https://developers.vtex.com/docs/guides/authentication) or [permissions](https://help.vtex.com/docs/tutorials/license-manager-resources). + */ +export const getFacetsByFacets = (options: Options) => (options.client ?? client).get({ url: '/facets/{facets}', ...options }); + +/** + * Get product + * + * Retrieves a single product by a known identifier. Use this endpoint for product detail pages (PDP) when you have a specific product ID, slug, EAN, SKU ID, or reference. + * + * >⚠️ Use this endpoint when you need data for one specific product whose identifier is already known (for example, rendering a PDP from a URL slug). Don't use it to fetch multiple products or to run a search query. Use `GET` [Search products](https://developers.vtex.com/docs/api-reference/intelligent-search-api-v1#get-/product-search/-facets-) for those cases. Misusing this endpoint for listings or search bypasses Intelligent Search ranking and impairs the shopper experience. + * + * When called with `field=id` (the default), the product is looked up directly, **skipping the search pipeline**, resulting in lower latency and higher cache-hit likelihood than product search. + * + * >ℹ️ **Caching:** Responses are cached for public sales channels. Private sales-channel responses are not cached. Always read the `Cache-Control` response header at runtime to determine cacheability. + * + * >ℹ️ **Segment context:** Several parameters on this endpoint replace values previously read from the VTEX segment cookie. See [Migrating from segment](#migrating-from-segment) below. + * + * ## Migrating from segment + * + * Intelligent Search API (Legacy) reads the following values from the VTEX segment cookie. In v1, pass each one directly as a query parameter: + * + * | v1 parameter | Segment source | + * |:---|:---| + * | `locale` | `segment.cultureInfo` | + * | `sc` | `segment.channel` | + * | `regionId` | `segment.regionId` | + * | `country` | `segment.countryCode` or `country` key in `segment.facets` | + * | `zip-code` | `zip-code` key in `segment.facets` | + * | `coordinates` | `coordinates` key in `segment.facets` | + * | `pickupPoint` | `pickupPoint` key in `segment.facets` | + * | `deliveryZonesHash` | `deliveryZonesHash` key in `segment.facets` | + * | `pickupPointsHash` | `pickupPointsHash` key in `segment.facets` | + * | `utmSource` | `segment.utm_source` | + * | `utmCampaign` | `segment.utm_campaign` | + * | `utmiCampaign` | `segment.utmi_campaign` | + * | `campaigns` | `segment.campaigns` | + * | `priceTables` | `segment.priceTables` | + * + *
+ * TypeScript reference implementation + * + * The following TypeScript snippet shows the full translation: + * + * ```typescript + * type Segment = { + * channel?: string | number + * regionId?: string + * countryCode?: string + * cultureInfo?: string + * // Semicolon-separated "key=value" string, e.g. "zip-code=22250-040;country=BRA" + * facets?: string + * utm_source?: string + * utm_campaign?: string + * utmi_campaign?: string + * campaigns?: string + * priceTables?: string + * } + * + * const SHIPPING_KEYS = new Set([ + * 'zip-code', 'coordinates', 'country', 'pickupPoint', + * 'deliveryZonesHash', 'pickupPointsHash', + * ]) + * + * function segmentToProductsV1(segment: Segment, identifier: string): string { + * const shipping: Record = {} + * + * for (const pair of (segment.facets ?? '').split(';')) { + * const eq = pair.indexOf('=') + * if (eq < 0) continue + * const key = pair.slice(0, eq) + * const value = pair.slice(eq + 1) + * if (!key || !value) continue + * if (SHIPPING_KEYS.has(key)) shipping[key] = value + * } + * + * const params: Record = {} + * const set = (name: string, value?: string | number) => { + * if (value !== undefined && value !== null && value !== '') { + * params[name] = String(value) + * } + * } + * + * set('sc', segment.channel) + * set('locale', segment.cultureInfo) + * set('regionId', segment.regionId) + * set('country', segment.countryCode ?? shipping.country) + * set('zip-code', shipping['zip-code']) + * set('coordinates', shipping.coordinates) + * set('pickupPoint', shipping.pickupPoint) + * set('deliveryZonesHash', shipping.deliveryZonesHash) + * set('pickupPointsHash', shipping.pickupPointsHash) + * set('utmSource', segment.utm_source) + * set('utmCampaign', segment.utm_campaign) + * set('utmiCampaign', segment.utmi_campaign) + * set('campaigns', segment.campaigns) + * set('priceTables', segment.priceTables) + * + * params.identifier = identifier + * + * const search = new URLSearchParams(params).toString() + * + * return `https://{accountName}.vtexcommercestable.com.br/api/intelligent-search/v1/products?${search}` + * } + * ``` + * + *
+ * + * ## Permissions + * + * This endpoint does not require [authentication](https://developers.vtex.com/docs/guides/authentication) or [permissions](https://help.vtex.com/docs/tutorials/license-manager-resources) for public sales channels. + */ +export const getProducts = (options: Options) => (options.client ?? client).get({ url: '/products', ...options }); + +/** + * Get pickup point availability for Delivery Promise + * + * Retrieves the list of available pickup points with their IDs, distances, addresses, and business hours. This endpoint returns pickup points sorted by distance from the provided coordinates. + * + * >ℹ️ This endpoint is designed for use in [Delivery Promise for headless stores](https://developers.vtex.com/docs/guides/delivery-promise-for-headless-stores) implementations. + * + * >ℹ️ **Caching:** Responses are cached for public sales channels. Private sales-channel responses are not cached. Always read the `Cache-Control` response header at runtime to determine cacheability. + * + * You can call this endpoint in two ways: + * + * - **With country and ZIP code:** Provide `country` and `zip-code` to retrieve pickup points based on location. + * - **With delivery zones and pickup hashes:** Provide pre-computed `deliveryZonesHash` and `pickupPointsHash` for faster lookup. + * + * >ℹ️ **Segment context:** Several parameters on this endpoint replace values previously read from the VTEX segment cookie. See [Migrating from segment](#migrating-from-segment) below. + * + * ## Migrating from segment + * + * Intelligent Search API (Legacy) reads the following values from the VTEX segment cookie. In v1, pass each one directly as a query parameter: + * + * | v1 parameter | Segment source | + * |:---|:---| + * | `locale` | `segment.cultureInfo` | + * | `sc` | `segment.channel` | + * | `country` | `segment.countryCode` or `country` key in `segment.facets` | + * | `zip-code` | `zip-code` key in `segment.facets` | + * | `coordinates` | `coordinates` key in `segment.facets` | + * | `pickupPoint` | `pickupPoint` key in `segment.facets` | + * | `deliveryZonesHash` | `deliveryZonesHash` key in `segment.facets` | + * | `pickupPointsHash` | `pickupPointsHash` key in `segment.facets` | + * + *
+ * TypeScript reference implementation + * + * The following TypeScript snippet shows the full translation: + * + * ```typescript + * type Segment = { + * channel?: string | number + * countryCode?: string + * cultureInfo?: string + * // Semicolon-separated "key=value" string, e.g. "zip-code=22250-040;country=BRA" + * facets?: string + * } + * + * const SHIPPING_KEYS = new Set([ + * 'zip-code', 'coordinates', 'country', 'pickupPoint', + * 'deliveryZonesHash', 'pickupPointsHash', + * ]) + * + * function segmentToPickupPointAvailabilityV1(segment: Segment): string { + * const shipping: Record = {} + * + * for (const pair of (segment.facets ?? '').split(';')) { + * const eq = pair.indexOf('=') + * if (eq < 0) continue + * const key = pair.slice(0, eq) + * const value = pair.slice(eq + 1) + * if (!key || !value) continue + * if (SHIPPING_KEYS.has(key)) shipping[key] = value + * } + * + * const params: Record = {} + * const set = (name: string, value?: string | number) => { + * if (value !== undefined && value !== null && value !== '') { + * params[name] = String(value) + * } + * } + * + * set('sc', segment.channel) + * set('locale', segment.cultureInfo) + * set('country', segment.countryCode ?? shipping.country) + * set('zip-code', shipping['zip-code']) + * set('coordinates', shipping.coordinates) + * set('pickupPoint', shipping.pickupPoint) + * set('deliveryZonesHash', shipping.deliveryZonesHash) + * set('pickupPointsHash', shipping.pickupPointsHash) + * + * const search = new URLSearchParams(params).toString() + * + * return `https://{accountName}.vtexcommercestable.com.br/api/intelligent-search/v1/pickup-point-availability?${search}` + * } + * ``` + * + *
+ * + * ## Permissions + * + * This endpoint does not require [authentication](https://developers.vtex.com/docs/guides/authentication) or [permissions](https://help.vtex.com/docs/tutorials/license-manager-resources). + */ +export const getPickupPointAvailabilityByFacets = (options: Options) => (options.client ?? client).get({ url: '/pickup-point-availability/{facets}', ...options }); diff --git a/vtex/server/generated/intelligent-search-api-v1/types.gen.ts b/vtex/server/generated/intelligent-search-api-v1/types.gen.ts new file mode 100644 index 00000000..3257d44a --- /dev/null +++ b/vtex/server/generated/intelligent-search-api-v1/types.gen.ts @@ -0,0 +1,2259 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type ClientOptions = { + baseUrl: 'https://{accountName}.{environment}.com.br/api/intelligent-search/v1' | (string & {}); +}; + +/** + * Response body object. + */ +export type AutocompleteSearchSuggestions = { + /** + * List of suggested facets and terms. + */ + searches?: Array<{ + /** + * Search term. + */ + term?: string; + /** + * Number of times the term was searched. + */ + count?: number; + /** + * List of facets in which the term can be searched. + */ + attributes?: Array<{ + /** + * Facet key. + */ + key?: string; + /** + * Facet value. + */ + value?: string; + /** + * Human-readable format of the facet key. + */ + labelKey?: string; + /** + * Human-readable format of the facet value. + */ + labelValue?: string; + }> | null; + }>; +}; + +/** + * Response body object. + */ +export type TopSearches = { + /** + * List of the most searched terms in the past 14 days. + */ + searches?: Array<{ + /** + * Search term. + */ + term?: string; + /** + * Number of times the term was searched. + */ + count?: number; + }>; +}; + +/** + * Response body object. + */ +export type Correction = { + /** + * Object that indicates if the term was misspelled and suggests a possible correction. + */ + correction?: { + /** + * Defines whether the term was misspelled (`true`) or not (`false`). + */ + misspelled?: boolean; + /** + * Defines whether the API was able to suggest a correction (`true`) or not (`false`). + */ + correction?: boolean; + /** + * The corrected term. Empty string when there is no correction. + */ + text?: string; + /** + * The corrected term with the corrected word highlighted using `` tags. Empty string when there is no correction. + */ + highlighted?: string; + }; +}; + +/** + * Response body object. + */ +export type Banners = { + /** + * List of banners. + */ + banners?: Array<{ + /** + * Banner ID. + */ + id?: string; + /** + * Banner name. + */ + name?: string; + /** + * Banner area, which can be a number between 1 and 4, to be used in the store's [Banner](https://developers.vtex.com/docs/guides/vtex-search-banner) block. + */ + area?: string; + /** + * Banner HTML, which can be an image or text. + */ + html?: string; + }>; +}; + +/** + * Response body object. + */ +export type SearchSuggestions = { + /** + * List of suggested terms. + */ + searches?: Array<{ + /** + * Search term. + */ + term?: string; + /** + * Number of times the term was searched. + */ + count?: number; + }>; +}; + +/** + * Response body object. + */ +export type ProductSearch = { + /** + * List of active products. Includes any sponsored products when requested. + */ + products?: Array; + /** + * Total number of matching products. + */ + recordsFiltered?: number; + /** + * Present when a spelling correction applies. + */ + correction?: { + /** + * Defines whether the search term is misspelled (`true`) or not (`false`). + */ + misspelled?: boolean; + }; + /** + * Indicates how the search engine corrected the misspelled word by using fuzzy logic. + */ + fuzzy?: string; + /** + * Indicates how the search engine dealt with the full-text query when there is more than one word. + */ + operator?: 'and' | 'or'; + /** + * Redirect URL when the query maps to a configured redirect rule. Present only when a redirect applies. + */ + redirect?: string | null; + /** + * Defines whether the list of products was translated by Intelligent Search (`true`) or not (`false`). + */ + translated?: boolean; + /** + * Pagination information. + */ + pagination?: { + /** + * Page count. + */ + count?: number; + /** + * Information about the current page. + */ + current?: { + /** + * Page index. + */ + index?: number; + }; + /** + * Information about the previous pages. + */ + before?: Array<{ + /** + * Page index. + */ + index?: number; + }>; + /** + * Information about the following pages. + */ + after?: Array<{ + /** + * Page index. + */ + index?: number; + }>; + /** + * Amount of results per page. + */ + perPage?: number; + /** + * Information about the next page. + */ + next?: { + /** + * Page index. + */ + index?: number; + }; + /** + * Information about the previous page. + */ + previous?: { + /** + * Page index. + */ + index?: number; + }; + /** + * Information about the first page. + */ + first?: { + /** + * Page index. + */ + index?: number; + }; + /** + * Information about the last page. + */ + last?: { + /** + * Page index. + */ + index?: number; + }; + }; + /** + * Search options available for the query. + */ + options?: { + /** + * Available sort options. + */ + sorts?: Array<{ + [key: string]: unknown; + }>; + /** + * Available product count options. + */ + counts?: Array<{ + [key: string]: unknown; + }>; + /** + * Whether Delivery Promise features are enabled for this query. + */ + deliveryPromisesEnabled?: boolean; + }; + /** + * Unique identifier for the search session. Use this value when sending search analytics events. + */ + searchId?: string; +}; + +/** + * Product information. + */ +export type Product = { + /** + * Cache ID. + */ + cacheId?: string; + /** + * Product unique identifier. + */ + productId?: string; + /** + * Product description. + */ + description?: string; + /** + * Product name. + */ + productName?: string; + /** + * Product reference code. + */ + productReference?: string; + /** + * Product slug (link text). + */ + linkText?: string; + /** + * Brand name. + */ + brand?: string; + /** + * Brand unique identifier. + */ + brandId?: number; + /** + * Product URL path in the store. + */ + link?: string; + /** + * Category paths. + */ + categories?: Array; + /** + * Category unique identifier. + */ + categoryId?: string; + /** + * List of category IDs in the corresponding category path. + */ + categoriesIds?: Array; + /** + * Price range information. + */ + priceRange?: { + /** + * Selling price range. + */ + sellingPrice?: { + /** + * Highest selling price. + */ + highPrice?: number; + /** + * Lowest selling price. + */ + lowPrice?: number; + }; + /** + * List price range. + */ + listPrice?: { + /** + * Highest list price. + */ + highPrice?: number; + /** + * Lowest list price. + */ + lowPrice?: number; + }; + }; + /** + * Specification groups information. + */ + specificationGroups?: Array<{ + /** + * Specification group original name. + */ + originalName?: string; + /** + * Specification group name. + */ + name?: string; + /** + * List of specifications. + */ + specifications?: Array<{ + /** + * Specification original name. + */ + originalName?: string; + /** + * Specification name. + */ + name?: string; + /** + * Specification values. + */ + values?: Array; + }>; + }>; + /** + * SKU specifications. + */ + skuSpecifications?: Array<{ + /** + * SKU specification field. + */ + field?: { + /** + * SKU specification field name. + */ + name?: string; + /** + * SKU specification field original name. + */ + originalName?: string; + }; + /** + * SKU specification field values. + */ + values?: Array<{ + /** + * SKU specification value name. + */ + name?: string; + /** + * SKU specification value original name. + */ + originalName?: string; + }>; + }>; + /** + * Product clusters (collections) the product belongs to. + */ + productClusters?: Array<{ + /** + * Cluster unique identifier. + */ + id?: string; + /** + * Cluster name. + */ + name?: string; + }>; + /** + * Cluster highlights information. + */ + clusterHighlights?: Array<{ + /** + * Cluster unique identifier. + */ + id?: string; + /** + * Cluster name. + */ + name?: string; + }>; + /** + * Product properties. + */ + properties?: Array<{ + /** + * Property name. + */ + name?: string; + /** + * Property original name. + */ + originalName?: string; + values?: Array; + }>; + /** + * Information about the related SKUs. + */ + items?: Array<{ + /** + * List of sellers. + */ + sellers?: Array<{ + /** + * Seller unique identifier. + */ + sellerId?: string; + /** + * Seller name. + */ + sellerName?: string; + /** + * Add to cart link. + */ + addToCartLink?: string; + /** + * Whether this is the default seller. + */ + sellerDefault?: boolean; + /** + * Commercial offer information. + */ + commertialOffer?: { + /** + * Delivery SLA samples per region. + */ + DeliverySlaSamplesPerRegion?: { + [key: string]: unknown; + }; + /** + * Delivery SLA samples. + */ + DeliverySlaSamples?: Array<{ + [key: string]: unknown; + }>; + /** + * Indicates availability. `10000` means available; `0` means unavailable. + */ + AvailableQuantity?: number; + /** + * Discount highlights. + */ + discountHighlights?: Array<{ + /** + * Discount highlight name. + */ + name?: string; + }>; + /** + * Installments information. + */ + Installments?: Array<{ + /** + * Payment system name. + */ + PaymentSystemName?: string; + /** + * Installment value. + */ + Value?: number; + /** + * Interest rate. + */ + InterestRate?: number; + /** + * Total value plus interest rate. + */ + TotalValuePlusInterestRate?: number; + /** + * Number of installments. + */ + NumberOfInstallments?: number; + /** + * Payment condition name. + */ + Name?: string; + /** + * Payment system group. + */ + PaymentSystemGroupName?: string; + }>; + /** + * Price of the item. + */ + Price?: number; + /** + * List price of the item. + */ + ListPrice?: number; + /** + * Special promotional price available under specific conditions, such as a discount for a specific payment method. May differ from `Price`. + */ + spotPrice?: number; + /** + * Tax percentage. + */ + taxPercentage?: number; + /** + * Price without discount. + */ + PriceWithoutDiscount?: number; + /** + * Tax value. + */ + Tax?: number; + /** + * List of gift SKU IDs. + */ + GiftSkuIds?: Array; + /** + * IDs of items that can be bought together with this item. + */ + BuyTogether?: Array; + /** + * Credit the customer receives when finalizing an order that includes this SKU. + */ + RewardValue?: number; + /** + * Date until the price is valid, in ISO 8601 format. + */ + PriceValidUntil?: string; + /** + * Get info error message. + */ + GetInfoErrorMessage?: string | null; + /** + * Cache version used to call Checkout. + */ + CacheVersionUsedToCallCheckout?: string; + /** + * Promotion teasers. + */ + teasers?: Array<{ + /** + * Promotion name. + */ + name?: string; + /** + * Conditions for the promotion to be valid. + */ + conditions?: { + /** + * Minimum quantity of the item. + */ + minimumQuantity?: number; + parameters?: Array<{ + name?: string; + value?: string; + }>; + }; + /** + * Promotion effects. + */ + effects?: { + parameters?: Array<{ + name?: string; + value?: string; + }>; + }; + }>; + }; + }>; + /** + * SKU images. + */ + images?: Array<{ + /** + * Image unique identifier. + */ + imageId?: string; + /** + * Cache ID. + */ + cacheId?: string; + /** + * HTML tag for the selected image. + */ + imageTag?: string; + /** + * Image label. + */ + imageLabel?: string; + /** + * Image text (alt text). + */ + imageText?: string; + /** + * Image URL. + */ + imageUrl?: string; + }>; + /** + * SKU unique identifier. + */ + itemId?: string; + /** + * SKU name. + */ + name?: string; + /** + * Combination of the product name and the SKU name. + */ + nameComplete?: string; + /** + * Complement name. + */ + complementName?: string; + /** + * SKU alternate IDs. + */ + referenceId?: Array<{ + /** + * Alternate ID key. + */ + Key?: string; + /** + * Alternate ID value. + */ + Value?: string; + }>; + /** + * Measurement unit. + */ + measurementUnit?: string; + /** + * Unit multiplier. If the multiplier is 5.0000, the product can be added in multiples of 5. + */ + unitMultiplier?: number; + /** + * Variations. + */ + variations?: Array<{ + /** + * Variation name. + */ + name?: string; + values?: Array; + }>; + /** + * EAN value. + */ + ean?: string; + /** + * Links an unusual type of SKU to a carrier specialized in delivering it (e.g. `"Refrigerated products"`). See [How the modal works](https://help.vtex.com/en/tutorial/how-does-the-modal-work--tutorials_125). + */ + modalType?: string; + /** + * SKU videos. + */ + videos?: Array; + /** + * Attachments related to the SKU. + */ + attachments?: Array<{ + /** + * Attachment unique identifier. + */ + id?: number; + /** + * Attachment name. + */ + name?: string; + /** + * Free-form JSON schema describing the attachment. + */ + schema?: { + [key: string]: unknown; + }; + /** + * Attachment fields. + */ + fields?: Array<{ + /** + * Field name. + */ + field_name?: string; + /** + * Maximum number of characters allowed for the field. + */ + max_characters?: string; + /** + * Allowed values for the field. + */ + domain_values?: string; + }>; + /** + * Whether the attachment is active. + */ + isActive?: boolean; + /** + * Whether the attachment is required. + */ + isRequired?: boolean; + }>; + /** + * Defines whether the SKU is a kit (`true`) or not (`false`). + */ + isKit?: boolean; + /** + * SKUs that compose the kit. Returned when `isKit` is `true`. + */ + kitItems?: Array<{ + /** + * Component SKU ID. + */ + itemId?: string; + /** + * Quantity of the component SKU per kit. + */ + amount?: number; + }> | null; + /** + * Estimated arrival date for the SKU, when configured. + */ + estimatedDateArrival?: string | null; + [key: string]: unknown | Array<{ + /** + * Seller unique identifier. + */ + sellerId?: string; + /** + * Seller name. + */ + sellerName?: string; + /** + * Add to cart link. + */ + addToCartLink?: string; + /** + * Whether this is the default seller. + */ + sellerDefault?: boolean; + /** + * Commercial offer information. + */ + commertialOffer?: { + /** + * Delivery SLA samples per region. + */ + DeliverySlaSamplesPerRegion?: { + [key: string]: unknown; + }; + /** + * Delivery SLA samples. + */ + DeliverySlaSamples?: Array<{ + [key: string]: unknown; + }>; + /** + * Indicates availability. `10000` means available; `0` means unavailable. + */ + AvailableQuantity?: number; + /** + * Discount highlights. + */ + discountHighlights?: Array<{ + /** + * Discount highlight name. + */ + name?: string; + }>; + /** + * Installments information. + */ + Installments?: Array<{ + /** + * Payment system name. + */ + PaymentSystemName?: string; + /** + * Installment value. + */ + Value?: number; + /** + * Interest rate. + */ + InterestRate?: number; + /** + * Total value plus interest rate. + */ + TotalValuePlusInterestRate?: number; + /** + * Number of installments. + */ + NumberOfInstallments?: number; + /** + * Payment condition name. + */ + Name?: string; + /** + * Payment system group. + */ + PaymentSystemGroupName?: string; + }>; + /** + * Price of the item. + */ + Price?: number; + /** + * List price of the item. + */ + ListPrice?: number; + /** + * Special promotional price available under specific conditions, such as a discount for a specific payment method. May differ from `Price`. + */ + spotPrice?: number; + /** + * Tax percentage. + */ + taxPercentage?: number; + /** + * Price without discount. + */ + PriceWithoutDiscount?: number; + /** + * Tax value. + */ + Tax?: number; + /** + * List of gift SKU IDs. + */ + GiftSkuIds?: Array; + /** + * IDs of items that can be bought together with this item. + */ + BuyTogether?: Array; + /** + * Credit the customer receives when finalizing an order that includes this SKU. + */ + RewardValue?: number; + /** + * Date until the price is valid, in ISO 8601 format. + */ + PriceValidUntil?: string; + /** + * Get info error message. + */ + GetInfoErrorMessage?: string | null; + /** + * Cache version used to call Checkout. + */ + CacheVersionUsedToCallCheckout?: string; + /** + * Promotion teasers. + */ + teasers?: Array<{ + /** + * Promotion name. + */ + name?: string; + /** + * Conditions for the promotion to be valid. + */ + conditions?: { + /** + * Minimum quantity of the item. + */ + minimumQuantity?: number; + parameters?: Array<{ + name?: string; + value?: string; + }>; + }; + /** + * Promotion effects. + */ + effects?: { + parameters?: Array<{ + name?: string; + value?: string; + }>; + }; + }>; + }; + }> | Array<{ + /** + * Image unique identifier. + */ + imageId?: string; + /** + * Cache ID. + */ + cacheId?: string; + /** + * HTML tag for the selected image. + */ + imageTag?: string; + /** + * Image label. + */ + imageLabel?: string; + /** + * Image text (alt text). + */ + imageText?: string; + /** + * Image URL. + */ + imageUrl?: string; + }> | string | Array<{ + /** + * Alternate ID key. + */ + Key?: string; + /** + * Alternate ID value. + */ + Value?: string; + }> | number | Array<{ + /** + * Variation name. + */ + name?: string; + values?: Array; + }> | Array | Array<{ + /** + * Attachment unique identifier. + */ + id?: number; + /** + * Attachment name. + */ + name?: string; + /** + * Free-form JSON schema describing the attachment. + */ + schema?: { + [key: string]: unknown; + }; + /** + * Attachment fields. + */ + fields?: Array<{ + /** + * Field name. + */ + field_name?: string; + /** + * Maximum number of characters allowed for the field. + */ + max_characters?: string; + /** + * Allowed values for the field. + */ + domain_values?: string; + }>; + /** + * Whether the attachment is active. + */ + isActive?: boolean; + /** + * Whether the attachment is required. + */ + isRequired?: boolean; + }> | boolean | Array<{ + /** + * Component SKU ID. + */ + itemId?: string; + /** + * Quantity of the component SKU per kit. + */ + amount?: number; + }> | null | string | null | undefined; + }>; + /** + * Release date. + */ + releaseDate?: number; + /** + * Origin of the product in the trade policy. + */ + origin?: string; +}; + +/** + * Response body object. + */ +export type Facets = { + /** + * List of facets. + */ + facets?: Array<{ + /** + * Possible values. + */ + values?: Array<{ + /** + * Value ID. + */ + id?: string; + /** + * Number of resulting products. + */ + quantity?: number; + /** + * Human-readable format of the facet value. + */ + name?: string; + /** + * Facet key. + */ + key?: string; + /** + * Facet value. + */ + value?: string; + /** + * Defines whether the value is selected (`true`) or not (`false`). + */ + selected?: boolean; + /** + * Query URL. + */ + href?: string; + }>; + /** + * Facet type, which can be: + * + * - `TEXT`: The value is a simple text. + * - `PRICERANGE`: The value contains the property `range` representing the minimum and the maximum price for the query. + * - `DELIVERY`: The value represents a delivery option. Only appears in searches using [Delivery Promise](https://help.vtex.com/docs/tutorials/delivery-promise-beta). + */ + type?: 'TEXT' | 'PRICERANGE' | 'DELIVERY'; + /** + * Human-readable format of the facet key. + */ + name?: string; + /** + * Defines whether the client-side should hide the facet (`true`) or not (`false`). + */ + hidden?: boolean; + /** + * Facet key. + */ + key?: string; + /** + * Number of possible values. + */ + quantity?: number; + }>; + /** + * Indicates whether there was sampling in the aggregation of facets. In search results with many products, only the first 30000 are aggregated to avoid performance issues. + */ + sampling?: boolean; + /** + * Generated breadcrumb for the given query. + */ + breadcrumb?: Array<{ + /** + * Breadcrumb label. + */ + name?: string; + /** + * Breadcrumb link. + */ + href?: string; + }>; + /** + * Term and facets used in the query. + */ + queryArgs?: { + /** + * Search term used in the query. + */ + query?: string; + /** + * Facets used in the query. + */ + selectedFacets?: Array<{ + /** + * Facet key. + */ + key?: string; + /** + * Facet value. + */ + value?: string; + }>; + }; + /** + * Defines whether the facets were translated by Intelligent Search (`true`) or not (`false`). + */ + translated?: boolean; +}; + +/** + * Error response information. + */ +export type ErrorResponse = { + /** + * HTTP status code. + */ + status?: number; + /** + * Error code. + */ + code?: string; + /** + * Error name. + */ + name?: string; + /** + * Error severity level. + */ + level?: string; + /** + * Response details. + */ + response?: { + /** + * Error response message. + */ + data?: string; + }; +}; + +/** + * Search term. It can contain any character. + * + * This parameter is named `query` in the API. The short form **`q`** is an alias for `query` and has the same semantics. + * + * You can search for products or SKUs using specific ID types by adding search parameters at the end of the store URL: + * + * - **Single item search:** `?query=[id type]:[id_1]`. Example: `?query=product:98765` + * - **Multiple items search:** `?query=[id type]:[id_1];[id_2];[id_3]`. Example: `?query=product:98765;98743` + * + * >⚠️ All searched IDs should be of the same type. + * + * ## Supported ID types + * + * | ID Type | Query format | Example | + * | - | - | - | + * | Product ID | `?query=product:` or `?query=product.id:` | `?query=product:98765` | + * | SKU ID | `?query=sku:` or `?query=sku.id:` | `?query=sku.id:12345` | + * | Reference ID | `?query=sku.reference:` | `?query=sku.reference:REF123` | + * | EAN | `?query=sku.ean:` | `?query=sku.ean:7891234567890` | + * | Slug | `?query=product.link:` | `?query=product.link:blue-shirt` | + */ +export type Query = string; + +/** + * ## Format + * + * The `facets` parameter follows the format: `/${facetKey1}/${facetValue1}/${facetKey2}/${facetValue2}/.../${facetKeyN}/${facetValueN}`. + * + * The order in which the terms appear is not relevant to the search. + * + * You can also repeat the same `facetKey` several times for different values. For example: `category-1/shoes/color/blue/color/red`. + * + * ## Filter combinations + * + * - **Facets of the same type → OR (union):** When multiple values of the same facet are applied, the API returns the union of all products matching any of those values. + * - **Facets of different types → AND (intersection):** When different facet types are combined, the API returns only products that satisfy all conditions simultaneously. + * + * ## Negative filters (NOT operator) + * + * To exclude a facet value, prefix the value with **`not:`** in the path segment: `/{facetKey}/not:{facetValue}/`. For example, `color/blue/size/not:42` keeps color blue and excludes size 42. + * + * ## Available filters + * + * | `facetKey` | Description | Example | + * | - | - | - | + * | `trade-policy` *(optional)* | Sales channel filter. Supported for backward compatibility; prefer the `sc` query parameter instead. | `trade-policy/2` | + * | `category-${n}` *(optional)* | Filter by category level (1 = department, 2 = category, 3 = subcategory, etc.). | `category-1/clothing/category-2/shirts` | + * | `brand` *(optional)* | Filter by brand slug. | `brand/acme` | + * | `{specificationName}` *(optional)* | Filter by catalog specification. | `color/blue` | + * | `productClusterIds` *(optional)* | Filter by collection ID. | `productClusterIds/262` | + * | `price` *(optional)* | Filter by price range `${minPrice}:${maxPrice}`. | `price/100:500` | + */ +export type FacetsPath = string | null; + +/** + * Indicates the target language as a BCP 47 language code. The Intelligent Search must have indexed the account in the target language. Intelligent Search API (Legacy) previously read this from `segment.cultureInfo`. In v1, pass the value directly as a query parameter. + */ +export type Locale = string | null; + +/** + * Defines the pricing and availability simulation behavior. + * + * - `default`: Calls the simulation for every single seller. + * - `skip`: Never calls the simulation. Use for the fastest response when live pricing is not required. + * - `only1P`: Only calls the simulation for first-party sellers. + * - `only3P`: Only calls the simulation for third-party sellers. + * - `regionalize1p`: Calls regionalized simulation for first-party sellers only. + */ +export type SimulationBehavior = 'default' | 'skip' | 'only1P' | 'only3P' | 'regionalize1p'; + +/** + * Defines whether the result should hide unavailable items (`true`) or not (`false`). When set to `true`, only products with stock are returned. + */ +export type HideUnavailableItems = boolean; + +/** + * Sales channel (trade policy) ID. Alternative to including `trade-policy/{id}` in the facets path. Intelligent Search API (Legacy) previously read this from `segment.channel`. In v1, pass the value directly as a query parameter. + */ +export type Sc = string; + +/** + * Region ID for regionalized results. Intelligent Search API (Legacy) previously read this from `segment.regionId`. In v1, pass the value directly as a query parameter. + */ +export type RegionId = string; + +/** + * Three-letter country code in [ISO 3166 ALPHA-3](https://www.iban.com/country-codes) format. Intelligent Search API (Legacy) previously read this from `segment.countryCode` or the `country` key in `segment.facets`. In v1, pass the value directly as a query parameter. + */ +export type Country = string; + +/** + * ZIP or postal code. Intelligent Search API (Legacy) previously read this from the `zip-code` key in `segment.facets`. In v1, pass the value directly as a query parameter. + */ +export type ZipCode = string; + +/** + * Geographic coordinates in the format `longitude,latitude`. Intelligent Search API (Legacy) previously read this from the `coordinates` key in `segment.facets`. In v1, pass the value directly as a query parameter. + */ +export type Coordinates = string; + +/** + * Pickup point ID for pickup-in-point delivery context. Intelligent Search API (Legacy) previously read this from the `pickupPoint` key in `segment.facets`. In v1, pass the value directly as a query parameter. + */ +export type PickupPoint = string; + +/** + * Pre-computed delivery zones hash for faster regionalization lookup. Obtain this value from the `POST` [Search delivery zones](https://developers.vtex.com/docs/api-reference/delivery-promise-suggestions-api#post-/api/logistics-shipping/delivery-zones/_search/v2) endpoint of the Delivery Promise Suggestions API. Intelligent Search API (Legacy) previously read this from the `deliveryZonesHash` key in `segment.facets`. In v1, pass the value directly as a query parameter. + */ +export type DeliveryZonesHash = string; + +/** + * Pre-computed pickup points hash for faster regionalization lookup. Obtain this value from the `POST` [Search pickup points](https://developers.vtex.com/docs/api-reference/delivery-promise-suggestions-api#post-/api/logistics-shipping/pickuppoints/_search) endpoint of the Delivery Promise Suggestions API. Intelligent Search API (Legacy) previously read this from the `pickupPointsHash` key in `segment.facets`. In v1, pass the value directly as a query parameter. + */ +export type PickupPointsHash = string; + +/** + * UTM source value, forwarded to the pricing and availability simulation. Intelligent Search API (Legacy) previously read this from `segment.utm_source`. In v1, pass the value directly as a query parameter. + */ +export type UtmSource = string; + +/** + * UTM campaign value, forwarded to the pricing and availability simulation. Intelligent Search API (Legacy) previously read this from `segment.utm_campaign`. In v1, pass the value directly as a query parameter. + */ +export type UtmCampaign = string; + +/** + * UTMi campaign value, forwarded to the pricing and availability simulation. Intelligent Search API (Legacy) previously read this from `segment.utmi_campaign`. In v1, pass the value directly as a query parameter. + */ +export type UtmiCampaign = string; + +/** + * Campaign identifier, forwarded to the pricing and availability simulation. Intelligent Search API (Legacy) previously read this from `segment.campaigns`. In v1, pass the value directly as a query parameter. + */ +export type Campaigns = string; + +/** + * Price table(s) to apply during simulation. Intelligent Search API (Legacy) previously read this from `segment.priceTables`. In v1, pass the value directly as a query parameter. + */ +export type PriceTables = string; + +/** + * Amount of sponsored products to be returned. Applicable only to merchants using [VTEX Ads](https://developers.vtex.com/docs/guides/vtex-ads). + */ +export type SponsoredCount = string; + +/** + * Advertisement placement. Applicable only to merchants using [VTEX Ads](https://developers.vtex.com/docs/guides/vtex-ads). + */ +export type AdvertisementPlacement = 'top_search' | 'middle_search' | 'search_shelf' | 'cart_shelf' | 'plp_shelf' | 'autocomplete' | 'homepage'; + +/** + * When `true`, the same product can appear as both sponsored and organic. When `false`, sponsored products are removed from the organic list. Applicable only to merchants using [VTEX Ads](https://developers.vtex.com/docs/guides/vtex-ads). + */ +export type RepeatSponsoredProducts = boolean; + +/** + * Indicates how the search engine will correct misspelled words by using fuzzy logic. It can be a number representing the max number of misspelled letters, or the string `auto` suggesting that the search engine should set this value by itself. + */ +export type Fuzzy = string; + +/** + * Indicates how the search engine will deal with the full-text query if there is more than one word. Set `and` if the returned products must have all the words in its metadata, or `or` otherwise. + */ +export type Operator = 'and' | 'or'; + +export type GetTopSearchesData = { + body?: never; + path?: never; + query?: { + /** + * Indicates the target language as a BCP 47 language code. The Intelligent Search must have indexed the account in the target language. Intelligent Search API (Legacy) previously read this from `segment.cultureInfo`. In v1, pass the value directly as a query parameter. + */ + locale?: string | null; + }; + url: '/top-searches'; +}; + +export type GetTopSearchesErrors = { + /** + * Bad request. Invalid parameters or missing account context. + */ + 400: unknown; + /** + * Internal server error or upstream failure. + */ + 500: unknown; +}; + +export type GetTopSearchesResponses = { + /** + * OK + */ + 200: TopSearches; +}; + +export type GetTopSearchesResponse = GetTopSearchesResponses[keyof GetTopSearchesResponses]; + +export type GetAutocompleteSuggestionsData = { + body?: never; + path?: never; + query?: { + /** + * Search term. It can contain any character. + * + * This parameter is named `query` in the API. The short form **`q`** is an alias for `query` and has the same semantics. + * + * You can search for products or SKUs using specific ID types by adding search parameters at the end of the store URL: + * + * - **Single item search:** `?query=[id type]:[id_1]`. Example: `?query=product:98765` + * - **Multiple items search:** `?query=[id type]:[id_1];[id_2];[id_3]`. Example: `?query=product:98765;98743` + * + * >⚠️ All searched IDs should be of the same type. + * + * ## Supported ID types + * + * | ID Type | Query format | Example | + * | - | - | - | + * | Product ID | `?query=product:` or `?query=product.id:` | `?query=product:98765` | + * | SKU ID | `?query=sku:` or `?query=sku.id:` | `?query=sku.id:12345` | + * | Reference ID | `?query=sku.reference:` | `?query=sku.reference:REF123` | + * | EAN | `?query=sku.ean:` | `?query=sku.ean:7891234567890` | + * | Slug | `?query=product.link:` | `?query=product.link:blue-shirt` | + */ + query?: string; + /** + * Indicates the target language as a BCP 47 language code. The Intelligent Search must have indexed the account in the target language. Intelligent Search API (Legacy) previously read this from `segment.cultureInfo`. In v1, pass the value directly as a query parameter. + */ + locale?: string | null; + }; + url: '/autocomplete-suggestions'; +}; + +export type GetAutocompleteSuggestionsErrors = { + /** + * Bad request. Invalid parameters or missing account context. + */ + 400: unknown; + /** + * Internal server error or upstream failure. + */ + 500: unknown; +}; + +export type GetAutocompleteSuggestionsResponses = { + /** + * OK + */ + 200: AutocompleteSearchSuggestions; +}; + +export type GetAutocompleteSuggestionsResponse = GetAutocompleteSuggestionsResponses[keyof GetAutocompleteSuggestionsResponses]; + +export type GetSearchSuggestionsData = { + body?: never; + path?: never; + query?: { + /** + * Search term. It can contain any character. + * + * This parameter is named `query` in the API. The short form **`q`** is an alias for `query` and has the same semantics. + * + * You can search for products or SKUs using specific ID types by adding search parameters at the end of the store URL: + * + * - **Single item search:** `?query=[id type]:[id_1]`. Example: `?query=product:98765` + * - **Multiple items search:** `?query=[id type]:[id_1];[id_2];[id_3]`. Example: `?query=product:98765;98743` + * + * >⚠️ All searched IDs should be of the same type. + * + * ## Supported ID types + * + * | ID Type | Query format | Example | + * | - | - | - | + * | Product ID | `?query=product:` or `?query=product.id:` | `?query=product:98765` | + * | SKU ID | `?query=sku:` or `?query=sku.id:` | `?query=sku.id:12345` | + * | Reference ID | `?query=sku.reference:` | `?query=sku.reference:REF123` | + * | EAN | `?query=sku.ean:` | `?query=sku.ean:7891234567890` | + * | Slug | `?query=product.link:` | `?query=product.link:blue-shirt` | + */ + query?: string; + /** + * Indicates the target language as a BCP 47 language code. The Intelligent Search must have indexed the account in the target language. Intelligent Search API (Legacy) previously read this from `segment.cultureInfo`. In v1, pass the value directly as a query parameter. + */ + locale?: string | null; + }; + url: '/search-suggestions'; +}; + +export type GetSearchSuggestionsErrors = { + /** + * Bad request. Invalid parameters or missing account context. + */ + 400: unknown; + /** + * Internal server error or upstream failure. + */ + 500: unknown; +}; + +export type GetSearchSuggestionsResponses = { + /** + * OK + */ + 200: SearchSuggestions; +}; + +export type GetSearchSuggestionsResponse = GetSearchSuggestionsResponses[keyof GetSearchSuggestionsResponses]; + +export type GetCorrectionSearchData = { + body?: never; + path?: never; + query?: { + /** + * Search term. It can contain any character. + * + * This parameter is named `query` in the API. The short form **`q`** is an alias for `query` and has the same semantics. + * + * You can search for products or SKUs using specific ID types by adding search parameters at the end of the store URL: + * + * - **Single item search:** `?query=[id type]:[id_1]`. Example: `?query=product:98765` + * - **Multiple items search:** `?query=[id type]:[id_1];[id_2];[id_3]`. Example: `?query=product:98765;98743` + * + * >⚠️ All searched IDs should be of the same type. + * + * ## Supported ID types + * + * | ID Type | Query format | Example | + * | - | - | - | + * | Product ID | `?query=product:` or `?query=product.id:` | `?query=product:98765` | + * | SKU ID | `?query=sku:` or `?query=sku.id:` | `?query=sku.id:12345` | + * | Reference ID | `?query=sku.reference:` | `?query=sku.reference:REF123` | + * | EAN | `?query=sku.ean:` | `?query=sku.ean:7891234567890` | + * | Slug | `?query=product.link:` | `?query=product.link:blue-shirt` | + */ + query?: string; + /** + * Indicates the target language as a BCP 47 language code. The Intelligent Search must have indexed the account in the target language. Intelligent Search API (Legacy) previously read this from `segment.cultureInfo`. In v1, pass the value directly as a query parameter. + */ + locale?: string | null; + }; + url: '/correction-search'; +}; + +export type GetCorrectionSearchErrors = { + /** + * Bad request. Invalid parameters or missing account context. + */ + 400: unknown; + /** + * Internal server error or upstream failure. + */ + 500: unknown; +}; + +export type GetCorrectionSearchResponses = { + /** + * OK + */ + 200: Correction; +}; + +export type GetCorrectionSearchResponse = GetCorrectionSearchResponses[keyof GetCorrectionSearchResponses]; + +export type GetBannersByFacetsData = { + body?: never; + path: { + /** + * ## Format + * + * The `facets` parameter follows the format: `/${facetKey1}/${facetValue1}/${facetKey2}/${facetValue2}/.../${facetKeyN}/${facetValueN}`. + * + * The order in which the terms appear is not relevant to the search. + * + * You can also repeat the same `facetKey` several times for different values. For example: `category-1/shoes/color/blue/color/red`. + * + * ## Filter combinations + * + * - **Facets of the same type → OR (union):** When multiple values of the same facet are applied, the API returns the union of all products matching any of those values. + * - **Facets of different types → AND (intersection):** When different facet types are combined, the API returns only products that satisfy all conditions simultaneously. + * + * ## Negative filters (NOT operator) + * + * To exclude a facet value, prefix the value with **`not:`** in the path segment: `/{facetKey}/not:{facetValue}/`. For example, `color/blue/size/not:42` keeps color blue and excludes size 42. + * + * ## Available filters + * + * | `facetKey` | Description | Example | + * | - | - | - | + * | `trade-policy` *(optional)* | Sales channel filter. Supported for backward compatibility; prefer the `sc` query parameter instead. | `trade-policy/2` | + * | `category-${n}` *(optional)* | Filter by category level (1 = department, 2 = category, 3 = subcategory, etc.). | `category-1/clothing/category-2/shirts` | + * | `brand` *(optional)* | Filter by brand slug. | `brand/acme` | + * | `{specificationName}` *(optional)* | Filter by catalog specification. | `color/blue` | + * | `productClusterIds` *(optional)* | Filter by collection ID. | `productClusterIds/262` | + * | `price` *(optional)* | Filter by price range `${minPrice}:${maxPrice}`. | `price/100:500` | + */ + facets: string | null; + }; + query?: { + /** + * Search term. It can contain any character. + * + * This parameter is named `query` in the API. The short form **`q`** is an alias for `query` and has the same semantics. + * + * You can search for products or SKUs using specific ID types by adding search parameters at the end of the store URL: + * + * - **Single item search:** `?query=[id type]:[id_1]`. Example: `?query=product:98765` + * - **Multiple items search:** `?query=[id type]:[id_1];[id_2];[id_3]`. Example: `?query=product:98765;98743` + * + * >⚠️ All searched IDs should be of the same type. + * + * ## Supported ID types + * + * | ID Type | Query format | Example | + * | - | - | - | + * | Product ID | `?query=product:` or `?query=product.id:` | `?query=product:98765` | + * | SKU ID | `?query=sku:` or `?query=sku.id:` | `?query=sku.id:12345` | + * | Reference ID | `?query=sku.reference:` | `?query=sku.reference:REF123` | + * | EAN | `?query=sku.ean:` | `?query=sku.ean:7891234567890` | + * | Slug | `?query=product.link:` | `?query=product.link:blue-shirt` | + */ + query?: string; + /** + * Indicates the target language as a BCP 47 language code. The Intelligent Search must have indexed the account in the target language. Intelligent Search API (Legacy) previously read this from `segment.cultureInfo`. In v1, pass the value directly as a query parameter. + */ + locale?: string | null; + }; + url: '/banners/{facets}'; +}; + +export type GetBannersByFacetsErrors = { + /** + * Bad request. Invalid parameters or missing account context. + */ + 400: unknown; + /** + * Internal server error or upstream failure. + */ + 500: unknown; +}; + +export type GetBannersByFacetsResponses = { + /** + * OK + */ + 200: Banners; +}; + +export type GetBannersByFacetsResponse = GetBannersByFacetsResponses[keyof GetBannersByFacetsResponses]; + +export type GetProductSearchByFacetsData = { + body?: never; + path: { + /** + * ## Format + * + * The `facets` parameter follows the format: `/${facetKey1}/${facetValue1}/${facetKey2}/${facetValue2}/.../${facetKeyN}/${facetValueN}`. + * + * The order in which the terms appear is not relevant to the search. + * + * You can also repeat the same `facetKey` several times for different values. For example: `category-1/shoes/color/blue/color/red`. + * + * ## Filter combinations + * + * - **Facets of the same type → OR (union):** When multiple values of the same facet are applied, the API returns the union of all products matching any of those values. + * - **Facets of different types → AND (intersection):** When different facet types are combined, the API returns only products that satisfy all conditions simultaneously. + * + * ## Negative filters (NOT operator) + * + * To exclude a facet value, prefix the value with **`not:`** in the path segment: `/{facetKey}/not:{facetValue}/`. For example, `color/blue/size/not:42` keeps color blue and excludes size 42. + * + * ## Available filters + * + * | `facetKey` | Description | Example | + * | - | - | - | + * | `trade-policy` *(optional)* | Sales channel filter. Supported for backward compatibility; prefer the `sc` query parameter instead. | `trade-policy/2` | + * | `category-${n}` *(optional)* | Filter by category level (1 = department, 2 = category, 3 = subcategory, etc.). | `category-1/clothing/category-2/shirts` | + * | `brand` *(optional)* | Filter by brand slug. | `brand/acme` | + * | `{specificationName}` *(optional)* | Filter by catalog specification. | `color/blue` | + * | `productClusterIds` *(optional)* | Filter by collection ID. | `productClusterIds/262` | + * | `price` *(optional)* | Filter by price range `${minPrice}:${maxPrice}`. | `price/100:500` | + */ + facets: string | null; + }; + query?: { + /** + * Search term. It can contain any character. + * + * This parameter is named `query` in the API. The short form **`q`** is an alias for `query` and has the same semantics. + * + * You can search for products or SKUs using specific ID types by adding search parameters at the end of the store URL: + * + * - **Single item search:** `?query=[id type]:[id_1]`. Example: `?query=product:98765` + * - **Multiple items search:** `?query=[id type]:[id_1];[id_2];[id_3]`. Example: `?query=product:98765;98743` + * + * >⚠️ All searched IDs should be of the same type. + * + * ## Supported ID types + * + * | ID Type | Query format | Example | + * | - | - | - | + * | Product ID | `?query=product:` or `?query=product.id:` | `?query=product:98765` | + * | SKU ID | `?query=sku:` or `?query=sku.id:` | `?query=sku.id:12345` | + * | Reference ID | `?query=sku.reference:` | `?query=sku.reference:REF123` | + * | EAN | `?query=sku.ean:` | `?query=sku.ean:7891234567890` | + * | Slug | `?query=product.link:` | `?query=product.link:blue-shirt` | + */ + query?: string; + /** + * Number of products per page. + */ + count?: number | null; + /** + * Current search page. + */ + page?: number | null; + /** + * Defines how results are sorted. Relevance is the **default** sorting type, applied when this parameter is omitted, null, or empty. + * + * Allowed values: + * - **Omitted, empty, or null** (default): Results are sorted by relevance. + * - `price:desc`: Results are sorted by price in descending order. + * - `price:asc`: Results are sorted by price in ascending order. + * - `orders:desc`: Results are sorted by the amount of orders in the past 90 days, in descending order. + * - `name:desc`: Results are sorted by name in descending alphabetical order. + * - `name:asc`: Results are sorted by name in ascending alphabetical order. + * - `release:desc`: Results are sorted by release date in descending order. + * - `discount:desc`: Results are sorted by discount percentage in descending order. + */ + sort?: 'price:desc' | 'price:asc' | 'orders:desc' | 'name:desc' | 'name:asc' | 'release:desc' | 'discount:desc' | null; + /** + * Indicates the target language as a BCP 47 language code. The Intelligent Search must have indexed the account in the target language. Intelligent Search API (Legacy) previously read this from `segment.cultureInfo`. In v1, pass the value directly as a query parameter. + */ + locale?: string | null; + /** + * Defines whether the result should hide unavailable items (`true`) or not (`false`). When set to `true`, only products with stock are returned. + */ + hideUnavailableItems?: boolean; + /** + * Defines the pricing and availability simulation behavior. + * + * - `default`: Calls the simulation for every single seller. + * - `skip`: Never calls the simulation. Use for the fastest response when live pricing is not required. + * - `only1P`: Only calls the simulation for first-party sellers. + * - `only3P`: Only calls the simulation for third-party sellers. + * - `regionalize1p`: Calls regionalized simulation for first-party sellers only. + */ + simulationBehavior?: 'default' | 'skip' | 'only1P' | 'only3P' | 'regionalize1p'; + /** + * Sales channel (trade policy) ID. Alternative to including `trade-policy/{id}` in the facets path. Intelligent Search API (Legacy) previously read this from `segment.channel`. In v1, pass the value directly as a query parameter. + */ + sc?: string; + /** + * Region ID for regionalized results. Intelligent Search API (Legacy) previously read this from `segment.regionId`. In v1, pass the value directly as a query parameter. + */ + regionId?: string; + /** + * Three-letter country code in [ISO 3166 ALPHA-3](https://www.iban.com/country-codes) format. Intelligent Search API (Legacy) previously read this from `segment.countryCode` or the `country` key in `segment.facets`. In v1, pass the value directly as a query parameter. + */ + country?: string; + /** + * ZIP or postal code. Intelligent Search API (Legacy) previously read this from the `zip-code` key in `segment.facets`. In v1, pass the value directly as a query parameter. + */ + 'zip-code'?: string; + /** + * Geographic coordinates in the format `longitude,latitude`. Intelligent Search API (Legacy) previously read this from the `coordinates` key in `segment.facets`. In v1, pass the value directly as a query parameter. + */ + coordinates?: string; + /** + * Pickup point ID for pickup-in-point delivery context. Intelligent Search API (Legacy) previously read this from the `pickupPoint` key in `segment.facets`. In v1, pass the value directly as a query parameter. + */ + pickupPoint?: string; + /** + * Pre-computed delivery zones hash for faster regionalization lookup. Obtain this value from the `POST` [Search delivery zones](https://developers.vtex.com/docs/api-reference/delivery-promise-suggestions-api#post-/api/logistics-shipping/delivery-zones/_search/v2) endpoint of the Delivery Promise Suggestions API. Intelligent Search API (Legacy) previously read this from the `deliveryZonesHash` key in `segment.facets`. In v1, pass the value directly as a query parameter. + */ + deliveryZonesHash?: string; + /** + * Pre-computed pickup points hash for faster regionalization lookup. Obtain this value from the `POST` [Search pickup points](https://developers.vtex.com/docs/api-reference/delivery-promise-suggestions-api#post-/api/logistics-shipping/pickuppoints/_search) endpoint of the Delivery Promise Suggestions API. Intelligent Search API (Legacy) previously read this from the `pickupPointsHash` key in `segment.facets`. In v1, pass the value directly as a query parameter. + */ + pickupPointsHash?: string; + /** + * UTM source value, forwarded to the pricing and availability simulation. Intelligent Search API (Legacy) previously read this from `segment.utm_source`. In v1, pass the value directly as a query parameter. + */ + utmSource?: string; + /** + * UTM campaign value, forwarded to the pricing and availability simulation. Intelligent Search API (Legacy) previously read this from `segment.utm_campaign`. In v1, pass the value directly as a query parameter. + */ + utmCampaign?: string; + /** + * UTMi campaign value, forwarded to the pricing and availability simulation. Intelligent Search API (Legacy) previously read this from `segment.utmi_campaign`. In v1, pass the value directly as a query parameter. + */ + utmiCampaign?: string; + /** + * Campaign identifier, forwarded to the pricing and availability simulation. Intelligent Search API (Legacy) previously read this from `segment.campaigns`. In v1, pass the value directly as a query parameter. + */ + campaigns?: string; + /** + * Price table(s) to apply during simulation. Intelligent Search API (Legacy) previously read this from `segment.priceTables`. In v1, pass the value directly as a query parameter. + */ + priceTables?: string; + /** + * Defines if sponsored products are listed (`true`) or not (`false`). Applicable to stores using [VTEX Ads](https://developers.vtex.com/docs/guides/vtex-ads) to offer ad space. + */ + showSponsored?: boolean | null; + /** + * Amount of sponsored products to be returned. Applicable only to merchants using [VTEX Ads](https://developers.vtex.com/docs/guides/vtex-ads). + */ + sponsoredCount?: string; + /** + * Advertisement placement. Applicable only to merchants using [VTEX Ads](https://developers.vtex.com/docs/guides/vtex-ads). + */ + advertisementPlacement?: 'top_search' | 'middle_search' | 'search_shelf' | 'cart_shelf' | 'plp_shelf' | 'autocomplete' | 'homepage'; + /** + * When `true`, the same product can appear as both sponsored and organic. When `false`, sponsored products are removed from the organic list. Applicable only to merchants using [VTEX Ads](https://developers.vtex.com/docs/guides/vtex-ads). + */ + repeatSponsoredProducts?: boolean; + }; + url: '/product-search/{facets}'; +}; + +export type GetProductSearchByFacetsErrors = { + /** + * Bad Request + */ + 400: ErrorResponse; + /** + * Internal Server Error + */ + 500: unknown; +}; + +export type GetProductSearchByFacetsError = GetProductSearchByFacetsErrors[keyof GetProductSearchByFacetsErrors]; + +export type GetProductSearchByFacetsResponses = { + /** + * OK + * + * List of products for the given query. + */ + 200: ProductSearch; +}; + +export type GetProductSearchByFacetsResponse = GetProductSearchByFacetsResponses[keyof GetProductSearchByFacetsResponses]; + +export type GetFacetsByFacetsData = { + body?: never; + path: { + /** + * ## Format + * + * The `facets` parameter follows the format: `/${facetKey1}/${facetValue1}/${facetKey2}/${facetValue2}/.../${facetKeyN}/${facetValueN}`. + * + * The order in which the terms appear is not relevant to the search. + * + * You can also repeat the same `facetKey` several times for different values. For example: `category-1/shoes/color/blue/color/red`. + * + * ## Filter combinations + * + * - **Facets of the same type → OR (union):** When multiple values of the same facet are applied, the API returns the union of all products matching any of those values. + * - **Facets of different types → AND (intersection):** When different facet types are combined, the API returns only products that satisfy all conditions simultaneously. + * + * ## Negative filters (NOT operator) + * + * To exclude a facet value, prefix the value with **`not:`** in the path segment: `/{facetKey}/not:{facetValue}/`. For example, `color/blue/size/not:42` keeps color blue and excludes size 42. + * + * ## Available filters + * + * | `facetKey` | Description | Example | + * | - | - | - | + * | `trade-policy` *(optional)* | Sales channel filter. Supported for backward compatibility; prefer the `sc` query parameter instead. | `trade-policy/2` | + * | `category-${n}` *(optional)* | Filter by category level (1 = department, 2 = category, 3 = subcategory, etc.). | `category-1/clothing/category-2/shirts` | + * | `brand` *(optional)* | Filter by brand slug. | `brand/acme` | + * | `{specificationName}` *(optional)* | Filter by catalog specification. | `color/blue` | + * | `productClusterIds` *(optional)* | Filter by collection ID. | `productClusterIds/262` | + * | `price` *(optional)* | Filter by price range `${minPrice}:${maxPrice}`. | `price/100:500` | + */ + facets: string | null; + }; + query?: { + /** + * Search term. It can contain any character. + * + * This parameter is named `query` in the API. The short form **`q`** is an alias for `query` and has the same semantics. + * + * You can search for products or SKUs using specific ID types by adding search parameters at the end of the store URL: + * + * - **Single item search:** `?query=[id type]:[id_1]`. Example: `?query=product:98765` + * - **Multiple items search:** `?query=[id type]:[id_1];[id_2];[id_3]`. Example: `?query=product:98765;98743` + * + * >⚠️ All searched IDs should be of the same type. + * + * ## Supported ID types + * + * | ID Type | Query format | Example | + * | - | - | - | + * | Product ID | `?query=product:` or `?query=product.id:` | `?query=product:98765` | + * | SKU ID | `?query=sku:` or `?query=sku.id:` | `?query=sku.id:12345` | + * | Reference ID | `?query=sku.reference:` | `?query=sku.reference:REF123` | + * | EAN | `?query=sku.ean:` | `?query=sku.ean:7891234567890` | + * | Slug | `?query=product.link:` | `?query=product.link:blue-shirt` | + */ + query?: string; + /** + * Indicates the target language as a BCP 47 language code. The Intelligent Search must have indexed the account in the target language. Intelligent Search API (Legacy) previously read this from `segment.cultureInfo`. In v1, pass the value directly as a query parameter. + */ + locale?: string | null; + /** + * Defines whether the result should hide unavailable items (`true`) or not (`false`). When set to `true`, only products with stock are returned. + */ + hideUnavailableItems?: boolean; + /** + * When `true`, hidden facets are omitted from the response. + */ + removeHiddenFacets?: boolean | null; + /** + * Sales channel (trade policy) ID. Alternative to including `trade-policy/{id}` in the facets path. Intelligent Search API (Legacy) previously read this from `segment.channel`. In v1, pass the value directly as a query parameter. + */ + sc?: string; + /** + * Region ID for regionalized results. Intelligent Search API (Legacy) previously read this from `segment.regionId`. In v1, pass the value directly as a query parameter. + */ + regionId?: string; + /** + * Three-letter country code in [ISO 3166 ALPHA-3](https://www.iban.com/country-codes) format. Intelligent Search API (Legacy) previously read this from `segment.countryCode` or the `country` key in `segment.facets`. In v1, pass the value directly as a query parameter. + */ + country?: string; + /** + * ZIP or postal code. Intelligent Search API (Legacy) previously read this from the `zip-code` key in `segment.facets`. In v1, pass the value directly as a query parameter. + */ + 'zip-code'?: string; + /** + * Geographic coordinates in the format `longitude,latitude`. Intelligent Search API (Legacy) previously read this from the `coordinates` key in `segment.facets`. In v1, pass the value directly as a query parameter. + */ + coordinates?: string; + /** + * Pickup point ID for pickup-in-point delivery context. Intelligent Search API (Legacy) previously read this from the `pickupPoint` key in `segment.facets`. In v1, pass the value directly as a query parameter. + */ + pickupPoint?: string; + /** + * Pre-computed delivery zones hash for faster regionalization lookup. Obtain this value from the `POST` [Search delivery zones](https://developers.vtex.com/docs/api-reference/delivery-promise-suggestions-api#post-/api/logistics-shipping/delivery-zones/_search/v2) endpoint of the Delivery Promise Suggestions API. Intelligent Search API (Legacy) previously read this from the `deliveryZonesHash` key in `segment.facets`. In v1, pass the value directly as a query parameter. + */ + deliveryZonesHash?: string; + /** + * Pre-computed pickup points hash for faster regionalization lookup. Obtain this value from the `POST` [Search pickup points](https://developers.vtex.com/docs/api-reference/delivery-promise-suggestions-api#post-/api/logistics-shipping/pickuppoints/_search) endpoint of the Delivery Promise Suggestions API. Intelligent Search API (Legacy) previously read this from the `pickupPointsHash` key in `segment.facets`. In v1, pass the value directly as a query parameter. + */ + pickupPointsHash?: string; + }; + url: '/facets/{facets}'; +}; + +export type GetFacetsByFacetsResponses = { + /** + * OK + * + * List of facets for the given query. + */ + 200: Facets; +}; + +export type GetFacetsByFacetsResponse = GetFacetsByFacetsResponses[keyof GetFacetsByFacetsResponses]; + +export type GetProductsData = { + body?: never; + path?: never; + query: { + /** + * Sales channel (trade policy) ID. Required for this endpoint to resolve pricing and availability. Intelligent Search API (Legacy) previously read this from `segment.channel`. In v1, pass the value directly as a query parameter. + */ + sc: string; + /** + * The identifier value to look up, interpreted according to the `field` parameter. + */ + value: string; + /** + * Which identifier type `value` represents. + * + * - `id` (default): product ID. Fastest: skips the search pipeline entirely. + * - `slug`: product slug (link text). + * - `ean`: SKU EAN. + * - `sku`: SKU ID. + * - `reference`: SKU reference ID (not the product reference). + */ + field?: 'id' | 'slug' | 'ean' | 'sku' | 'reference'; + /** + * Indicates the target language as a BCP 47 language code. The Intelligent Search must have indexed the account in the target language. Intelligent Search API (Legacy) previously read this from `segment.cultureInfo`. In v1, pass the value directly as a query parameter. + */ + locale?: string | null; + /** + * Defines the pricing and availability simulation behavior. + * + * - `default`: Calls the simulation for every single seller. + * - `skip`: Never calls the simulation. Use for the fastest response when live pricing is not required. + * - `only1P`: Only calls the simulation for first-party sellers. + * - `only3P`: Only calls the simulation for third-party sellers. + * - `regionalize1p`: Calls regionalized simulation for first-party sellers only. + */ + simulationBehavior?: 'default' | 'skip' | 'only1P' | 'only3P' | 'regionalize1p'; + /** + * Defines whether the result should hide unavailable items (`true`) or not (`false`). When set to `true`, only products with stock are returned. + */ + hideUnavailableItems?: boolean; + /** + * Restrict to a cluster. Returns `404` if the product is not in this cluster. + */ + productClusterId?: string; + /** + * When `true`, returns the product in Catalog (portal) format instead of Intelligent Search format. + */ + productOriginVtex?: boolean; + /** + * When `true`, skips the catalog visibility (`isVisible`) check. Useful for preview and admin flows. + */ + 'show-invisible-items'?: boolean; + /** + * Region ID for regionalized results. Intelligent Search API (Legacy) previously read this from `segment.regionId`. In v1, pass the value directly as a query parameter. + */ + regionId?: string; + /** + * Three-letter country code in [ISO 3166 ALPHA-3](https://www.iban.com/country-codes) format. Intelligent Search API (Legacy) previously read this from `segment.countryCode` or the `country` key in `segment.facets`. In v1, pass the value directly as a query parameter. + */ + country?: string; + /** + * ZIP or postal code. Intelligent Search API (Legacy) previously read this from the `zip-code` key in `segment.facets`. In v1, pass the value directly as a query parameter. + */ + 'zip-code'?: string; + /** + * Geographic coordinates in the format `longitude,latitude`. Intelligent Search API (Legacy) previously read this from the `coordinates` key in `segment.facets`. In v1, pass the value directly as a query parameter. + */ + coordinates?: string; + /** + * Pickup point ID for pickup-in-point delivery context. Intelligent Search API (Legacy) previously read this from the `pickupPoint` key in `segment.facets`. In v1, pass the value directly as a query parameter. + */ + pickupPoint?: string; + /** + * Pre-computed delivery zones hash for faster regionalization lookup. Obtain this value from the `POST` [Search delivery zones](https://developers.vtex.com/docs/api-reference/delivery-promise-suggestions-api#post-/api/logistics-shipping/delivery-zones/_search/v2) endpoint of the Delivery Promise Suggestions API. Intelligent Search API (Legacy) previously read this from the `deliveryZonesHash` key in `segment.facets`. In v1, pass the value directly as a query parameter. + */ + deliveryZonesHash?: string; + /** + * Pre-computed pickup points hash for faster regionalization lookup. Obtain this value from the `POST` [Search pickup points](https://developers.vtex.com/docs/api-reference/delivery-promise-suggestions-api#post-/api/logistics-shipping/pickuppoints/_search) endpoint of the Delivery Promise Suggestions API. Intelligent Search API (Legacy) previously read this from the `pickupPointsHash` key in `segment.facets`. In v1, pass the value directly as a query parameter. + */ + pickupPointsHash?: string; + /** + * UTM source value, forwarded to the pricing and availability simulation. Intelligent Search API (Legacy) previously read this from `segment.utm_source`. In v1, pass the value directly as a query parameter. + */ + utmSource?: string; + /** + * UTM campaign value, forwarded to the pricing and availability simulation. Intelligent Search API (Legacy) previously read this from `segment.utm_campaign`. In v1, pass the value directly as a query parameter. + */ + utmCampaign?: string; + /** + * UTMi campaign value, forwarded to the pricing and availability simulation. Intelligent Search API (Legacy) previously read this from `segment.utmi_campaign`. In v1, pass the value directly as a query parameter. + */ + utmiCampaign?: string; + /** + * Campaign identifier, forwarded to the pricing and availability simulation. Intelligent Search API (Legacy) previously read this from `segment.campaigns`. In v1, pass the value directly as a query parameter. + */ + campaigns?: string; + /** + * Price table(s) to apply during simulation. Intelligent Search API (Legacy) previously read this from `segment.priceTables`. In v1, pass the value directly as a query parameter. + */ + priceTables?: string; + }; + url: '/products'; +}; + +export type GetProductsErrors = { + /** + * Bad Request: missing or invalid parameters (for example, missing `sc` or `value`). + */ + 400: unknown; + /** + * Unauthorized: private sales channel requires valid authentication. + */ + 401: unknown; + /** + * Forbidden: user is not allowed to access this resource. + */ + 403: unknown; + /** + * Not Found: product not found, or not in the requested `productClusterId`. + */ + 404: unknown; + /** + * Internal Server Error + */ + 500: unknown; +}; + +export type GetProductsResponses = { + /** + * OK + * + * Single product object. The response is the product itself; there is no `recordsFiltered`, `pagination`, or `searchId` wrapper. + */ + 200: Product; +}; + +export type GetProductsResponse = GetProductsResponses[keyof GetProductsResponses]; + +export type GetPickupPointAvailabilityByFacetsData = { + body?: never; + path: { + /** + * ## Format + * + * The `facets` parameter follows the format: `/${facetKey1}/${facetValue1}/${facetKey2}/${facetValue2}/.../${facetKeyN}/${facetValueN}`. + * + * The order in which the terms appear is not relevant to the search. + * + * You can also repeat the same `facetKey` several times for different values. For example: `category-1/shoes/color/blue/color/red`. + * + * ## Filter combinations + * + * - **Facets of the same type → OR (union):** When multiple values of the same facet are applied, the API returns the union of all products matching any of those values. + * - **Facets of different types → AND (intersection):** When different facet types are combined, the API returns only products that satisfy all conditions simultaneously. + * + * ## Negative filters (NOT operator) + * + * To exclude a facet value, prefix the value with **`not:`** in the path segment: `/{facetKey}/not:{facetValue}/`. For example, `color/blue/size/not:42` keeps color blue and excludes size 42. + * + * ## Available filters + * + * | `facetKey` | Description | Example | + * | - | - | - | + * | `trade-policy` *(optional)* | Sales channel filter. Supported for backward compatibility; prefer the `sc` query parameter instead. | `trade-policy/2` | + * | `category-${n}` *(optional)* | Filter by category level (1 = department, 2 = category, 3 = subcategory, etc.). | `category-1/clothing/category-2/shirts` | + * | `brand` *(optional)* | Filter by brand slug. | `brand/acme` | + * | `{specificationName}` *(optional)* | Filter by catalog specification. | `color/blue` | + * | `productClusterIds` *(optional)* | Filter by collection ID. | `productClusterIds/262` | + * | `price` *(optional)* | Filter by price range `${minPrice}:${maxPrice}`. | `price/100:500` | + */ + facets: string | null; + }; + query?: { + /** + * Search term. It can contain any character. + * + * This parameter is named `query` in the API. The short form **`q`** is an alias for `query` and has the same semantics. + * + * You can search for products or SKUs using specific ID types by adding search parameters at the end of the store URL: + * + * - **Single item search:** `?query=[id type]:[id_1]`. Example: `?query=product:98765` + * - **Multiple items search:** `?query=[id type]:[id_1];[id_2];[id_3]`. Example: `?query=product:98765;98743` + * + * >⚠️ All searched IDs should be of the same type. + * + * ## Supported ID types + * + * | ID Type | Query format | Example | + * | - | - | - | + * | Product ID | `?query=product:` or `?query=product.id:` | `?query=product:98765` | + * | SKU ID | `?query=sku:` or `?query=sku.id:` | `?query=sku.id:12345` | + * | Reference ID | `?query=sku.reference:` | `?query=sku.reference:REF123` | + * | EAN | `?query=sku.ean:` | `?query=sku.ean:7891234567890` | + * | Slug | `?query=product.link:` | `?query=product.link:blue-shirt` | + */ + query?: string; + /** + * Indicates the target language as a BCP 47 language code. The Intelligent Search must have indexed the account in the target language. Intelligent Search API (Legacy) previously read this from `segment.cultureInfo`. In v1, pass the value directly as a query parameter. + */ + locale?: string | null; + /** + * Pre-computed hash for delivery zones. Required when using the hashes approach (alternative to country and ZIP code). + */ + deliveryZonesHash?: string; + /** + * Pre-computed hash for pickup points. Required when using the hashes approach (alternative to country and ZIP code). + */ + pickupPointsHash?: string; + /** + * Three-letter country code in [ISO 3166 ALPHA-3](https://www.iban.com/country-codes) format. Required when using the country and ZIP code approach. + */ + country?: string; + /** + * ZIP code or postal code. Required when using the country and ZIP code approach. + */ + 'zip-code'?: string; + /** + * Geographic coordinates in the format `longitude,latitude`. Used to sort results by proximity. Optional: the server derives coordinates from `zip-code` and `country` when not provided. + */ + coordinates?: string; + /** + * Pickup point ID to filter results to a specific pickup point. + */ + pickupPoint?: string; + }; + url: '/pickup-point-availability/{facets}'; +}; + +export type GetPickupPointAvailabilityByFacetsErrors = { + /** + * Bad Request: delivery context could not be resolved (neither hashes nor country + ZIP code were usable), or invalid parameters. + */ + 400: unknown; + /** + * Internal Server Error + */ + 500: unknown; +}; + +export type GetPickupPointAvailabilityByFacetsResponses = { + /** + * Pickup points availability response. + */ + 200: { + /** + * List of available pickup points sorted by distance ascending. + */ + pickupPointDistances?: Array<{ + /** + * Unique identifier for the pickup point. + */ + pickupId?: string; + /** + * Name of the pickup point. + */ + pickupName?: string; + /** + * Distance from the provided coordinates to the pickup point, in kilometers. + */ + distance?: number; + /** + * Indicates whether the pickup point is currently active (`true`) or not (`false`). + */ + isActive?: boolean; + /** + * Address details of the pickup point. + */ + address?: { + /** + * Street name. + */ + street?: string; + /** + * Street number. + */ + number?: string; + /** + * Neighborhood. + */ + neighborhood?: string; + /** + * City. + */ + city?: string; + /** + * State or province. + */ + state?: string; + /** + * Postal code. + */ + postalCode?: string; + }; + /** + * Operating hours for each day of the week. + */ + businessHours?: Array<{ + /** + * Day of the week (0 = Sunday, 1 = Monday, ..., 6 = Saturday). + */ + dayOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6; + /** + * Opening time in 24-hour format (HH:MM:SS). + */ + openingTime?: string; + /** + * Closing time in 24-hour format (HH:MM:SS). + */ + closingTime?: string; + }>; + }>; + }; +}; + +export type GetPickupPointAvailabilityByFacetsResponse = GetPickupPointAvailabilityByFacetsResponses[keyof GetPickupPointAvailabilityByFacetsResponses]; diff --git a/vtex/server/generated/intelligent-search-api-v1/zod.gen.ts b/vtex/server/generated/intelligent-search-api-v1/zod.gen.ts new file mode 100644 index 00000000..d42b49c9 --- /dev/null +++ b/vtex/server/generated/intelligent-search-api-v1/zod.gen.ts @@ -0,0 +1,750 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import * as z from 'zod'; + +/** + * Response body object. + */ +export const zAutocompleteSearchSuggestions = z.object({ + searches: z.optional(z.array(z.object({ + term: z.optional(z.string()), + count: z.optional(z.number()), + attributes: z.optional(z.union([ + z.array(z.object({ + key: z.optional(z.string()), + value: z.optional(z.string()), + labelKey: z.optional(z.string()), + labelValue: z.optional(z.string()) + })), + z.null() + ])) + }))) +}); + +/** + * Response body object. + */ +export const zTopSearches = z.object({ + searches: z.optional(z.array(z.object({ + term: z.optional(z.string()), + count: z.optional(z.number()) + }))) +}); + +/** + * Response body object. + */ +export const zCorrection = z.object({ + correction: z.optional(z.object({ + misspelled: z.optional(z.boolean()), + correction: z.optional(z.boolean()), + text: z.optional(z.string()), + highlighted: z.optional(z.string()) + })) +}); + +/** + * Response body object. + */ +export const zBanners = z.object({ + banners: z.optional(z.array(z.object({ + id: z.optional(z.string()), + name: z.optional(z.string()), + area: z.optional(z.string()), + html: z.optional(z.string()) + }))) +}); + +/** + * Response body object. + */ +export const zSearchSuggestions = z.object({ + searches: z.optional(z.array(z.object({ + term: z.optional(z.string()), + count: z.optional(z.number()) + }))) +}); + +/** + * Product information. + */ +export const zProduct = z.object({ + cacheId: z.optional(z.string()), + productId: z.optional(z.string()), + description: z.optional(z.string()), + productName: z.optional(z.string()), + productReference: z.optional(z.string()), + linkText: z.optional(z.string()), + brand: z.optional(z.string()), + brandId: z.optional(z.number()), + link: z.optional(z.string()), + categories: z.optional(z.array(z.string())), + categoryId: z.optional(z.string()), + categoriesIds: z.optional(z.array(z.string())), + priceRange: z.optional(z.object({ + sellingPrice: z.optional(z.object({ + highPrice: z.optional(z.number()), + lowPrice: z.optional(z.number()) + })), + listPrice: z.optional(z.object({ + highPrice: z.optional(z.number()), + lowPrice: z.optional(z.number()) + })) + })), + specificationGroups: z.optional(z.array(z.object({ + originalName: z.optional(z.string()), + name: z.optional(z.string()), + specifications: z.optional(z.array(z.object({ + originalName: z.optional(z.string()), + name: z.optional(z.string()), + values: z.optional(z.array(z.string())) + }))) + }))), + skuSpecifications: z.optional(z.array(z.object({ + field: z.optional(z.object({ + name: z.optional(z.string()), + originalName: z.optional(z.string()) + })), + values: z.optional(z.array(z.object({ + name: z.optional(z.string()), + originalName: z.optional(z.string()) + }))) + }))), + productClusters: z.optional(z.array(z.object({ + id: z.optional(z.string()), + name: z.optional(z.string()) + }))), + clusterHighlights: z.optional(z.array(z.object({ + id: z.optional(z.string()), + name: z.optional(z.string()) + }))), + properties: z.optional(z.array(z.object({ + name: z.optional(z.string()), + originalName: z.optional(z.string()), + values: z.optional(z.array(z.string())) + }))), + items: z.optional(z.array(z.object({ + sellers: z.optional(z.array(z.object({ + sellerId: z.optional(z.string()), + sellerName: z.optional(z.string()), + addToCartLink: z.optional(z.string()), + sellerDefault: z.optional(z.boolean()), + commertialOffer: z.optional(z.object({ + DeliverySlaSamplesPerRegion: z.optional(z.record(z.string(), z.unknown())), + DeliverySlaSamples: z.optional(z.array(z.record(z.string(), z.unknown()))), + AvailableQuantity: z.optional(z.number()), + discountHighlights: z.optional(z.array(z.object({ + name: z.optional(z.string()) + }))), + Installments: z.optional(z.array(z.object({ + PaymentSystemName: z.optional(z.string()), + Value: z.optional(z.number()), + InterestRate: z.optional(z.number()), + TotalValuePlusInterestRate: z.optional(z.number()), + NumberOfInstallments: z.optional(z.number()), + Name: z.optional(z.string()), + PaymentSystemGroupName: z.optional(z.string()) + }))), + Price: z.optional(z.number()), + ListPrice: z.optional(z.number()), + spotPrice: z.optional(z.number()), + taxPercentage: z.optional(z.number()), + PriceWithoutDiscount: z.optional(z.number()), + Tax: z.optional(z.number()), + GiftSkuIds: z.optional(z.array(z.string())), + BuyTogether: z.optional(z.array(z.string())), + RewardValue: z.optional(z.number()), + PriceValidUntil: z.optional(z.string()), + GetInfoErrorMessage: z.optional(z.union([ + z.string(), + z.null() + ])), + CacheVersionUsedToCallCheckout: z.optional(z.string()), + teasers: z.optional(z.array(z.object({ + name: z.optional(z.string()), + conditions: z.optional(z.object({ + minimumQuantity: z.optional(z.number()), + parameters: z.optional(z.array(z.object({ + name: z.optional(z.string()), + value: z.optional(z.string()) + }))) + })), + effects: z.optional(z.object({ + parameters: z.optional(z.array(z.object({ + name: z.optional(z.string()), + value: z.optional(z.string()) + }))) + })) + }))) + })) + }))), + images: z.optional(z.array(z.object({ + imageId: z.optional(z.string()), + cacheId: z.optional(z.string()), + imageTag: z.optional(z.string()), + imageLabel: z.optional(z.string()), + imageText: z.optional(z.string()), + imageUrl: z.optional(z.string()) + }))), + itemId: z.optional(z.string()), + name: z.optional(z.string()), + nameComplete: z.optional(z.string()), + complementName: z.optional(z.string()), + referenceId: z.optional(z.array(z.object({ + Key: z.optional(z.string()), + Value: z.optional(z.string()) + }))), + measurementUnit: z.optional(z.string()), + unitMultiplier: z.optional(z.number()), + variations: z.optional(z.array(z.object({ + name: z.optional(z.string()), + values: z.optional(z.array(z.string())) + }))), + ean: z.optional(z.string()), + modalType: z.optional(z.string()), + videos: z.optional(z.array(z.string())), + attachments: z.optional(z.array(z.object({ + id: z.optional(z.number()), + name: z.optional(z.string()), + schema: z.optional(z.record(z.string(), z.unknown())), + fields: z.optional(z.array(z.object({ + field_name: z.optional(z.string()), + max_characters: z.optional(z.string()), + domain_values: z.optional(z.string()) + }))), + isActive: z.optional(z.boolean()), + isRequired: z.optional(z.boolean()) + }))), + isKit: z.optional(z.boolean()), + kitItems: z.optional(z.union([ + z.array(z.object({ + itemId: z.optional(z.string()), + amount: z.optional(z.number()) + })), + z.null() + ])), + estimatedDateArrival: z.optional(z.union([ + z.string(), + z.null() + ])) + }))), + releaseDate: z.optional(z.number()), + origin: z.optional(z.string()) +}); + +/** + * Response body object. + */ +export const zProductSearch = z.object({ + products: z.optional(z.array(zProduct)), + recordsFiltered: z.optional(z.number()), + correction: z.optional(z.object({ + misspelled: z.optional(z.boolean()) + })), + fuzzy: z.optional(z.string()), + operator: z.optional(z.enum(['and', 'or'])), + redirect: z.optional(z.union([ + z.string(), + z.null() + ])), + translated: z.optional(z.boolean()), + pagination: z.optional(z.object({ + count: z.optional(z.number()), + current: z.optional(z.object({ + index: z.optional(z.number()) + })), + before: z.optional(z.array(z.object({ + index: z.optional(z.number()) + }))), + after: z.optional(z.array(z.object({ + index: z.optional(z.number()) + }))), + perPage: z.optional(z.number()), + next: z.optional(z.object({ + index: z.optional(z.number()) + })), + previous: z.optional(z.object({ + index: z.optional(z.number()) + })), + first: z.optional(z.object({ + index: z.optional(z.number()) + })), + last: z.optional(z.object({ + index: z.optional(z.number()) + })) + })), + options: z.optional(z.object({ + sorts: z.optional(z.array(z.record(z.string(), z.unknown()))), + counts: z.optional(z.array(z.record(z.string(), z.unknown()))), + deliveryPromisesEnabled: z.optional(z.boolean()) + })), + searchId: z.optional(z.string()) +}); + +/** + * Response body object. + */ +export const zFacets = z.object({ + facets: z.optional(z.array(z.object({ + values: z.optional(z.array(z.object({ + id: z.optional(z.string()), + quantity: z.optional(z.number()), + name: z.optional(z.string()), + key: z.optional(z.string()), + value: z.optional(z.string()), + selected: z.optional(z.boolean()), + href: z.optional(z.string()) + }))), + type: z.optional(z.enum([ + 'TEXT', + 'PRICERANGE', + 'DELIVERY' + ])), + name: z.optional(z.string()), + hidden: z.optional(z.boolean()), + key: z.optional(z.string()), + quantity: z.optional(z.number()) + }))), + sampling: z.optional(z.boolean()), + breadcrumb: z.optional(z.array(z.object({ + name: z.optional(z.string()), + href: z.optional(z.string()) + }))), + queryArgs: z.optional(z.object({ + query: z.optional(z.string()), + selectedFacets: z.optional(z.array(z.object({ + key: z.optional(z.string()), + value: z.optional(z.string()) + }))) + })), + translated: z.optional(z.boolean()) +}); + +/** + * Error response information. + */ +export const zErrorResponse = z.object({ + status: z.optional(z.int()), + code: z.optional(z.string()), + name: z.optional(z.string()), + level: z.optional(z.string()), + response: z.optional(z.object({ + data: z.optional(z.string()) + })) +}); + +/** + * Search term. It can contain any character. + * + * This parameter is named `query` in the API. The short form **`q`** is an alias for `query` and has the same semantics. + * + * You can search for products or SKUs using specific ID types by adding search parameters at the end of the store URL: + * + * - **Single item search:** `?query=[id type]:[id_1]`. Example: `?query=product:98765` + * - **Multiple items search:** `?query=[id type]:[id_1];[id_2];[id_3]`. Example: `?query=product:98765;98743` + * + * >⚠️ All searched IDs should be of the same type. + * + * ## Supported ID types + * + * | ID Type | Query format | Example | + * | - | - | - | + * | Product ID | `?query=product:` or `?query=product.id:` | `?query=product:98765` | + * | SKU ID | `?query=sku:` or `?query=sku.id:` | `?query=sku.id:12345` | + * | Reference ID | `?query=sku.reference:` | `?query=sku.reference:REF123` | + * | EAN | `?query=sku.ean:` | `?query=sku.ean:7891234567890` | + * | Slug | `?query=product.link:` | `?query=product.link:blue-shirt` | + */ +export const zQuery = z.string(); + +/** + * ## Format + * + * The `facets` parameter follows the format: `/${facetKey1}/${facetValue1}/${facetKey2}/${facetValue2}/.../${facetKeyN}/${facetValueN}`. + * + * The order in which the terms appear is not relevant to the search. + * + * You can also repeat the same `facetKey` several times for different values. For example: `category-1/shoes/color/blue/color/red`. + * + * ## Filter combinations + * + * - **Facets of the same type → OR (union):** When multiple values of the same facet are applied, the API returns the union of all products matching any of those values. + * - **Facets of different types → AND (intersection):** When different facet types are combined, the API returns only products that satisfy all conditions simultaneously. + * + * ## Negative filters (NOT operator) + * + * To exclude a facet value, prefix the value with **`not:`** in the path segment: `/{facetKey}/not:{facetValue}/`. For example, `color/blue/size/not:42` keeps color blue and excludes size 42. + * + * ## Available filters + * + * | `facetKey` | Description | Example | + * | - | - | - | + * | `trade-policy` *(optional)* | Sales channel filter. Supported for backward compatibility; prefer the `sc` query parameter instead. | `trade-policy/2` | + * | `category-${n}` *(optional)* | Filter by category level (1 = department, 2 = category, 3 = subcategory, etc.). | `category-1/clothing/category-2/shirts` | + * | `brand` *(optional)* | Filter by brand slug. | `brand/acme` | + * | `{specificationName}` *(optional)* | Filter by catalog specification. | `color/blue` | + * | `productClusterIds` *(optional)* | Filter by collection ID. | `productClusterIds/262` | + * | `price` *(optional)* | Filter by price range `${minPrice}:${maxPrice}`. | `price/100:500` | + */ +export const zFacetsPath = z.union([ + z.string().default('/'), + z.null() +]).default('/'); + +/** + * Indicates the target language as a BCP 47 language code. The Intelligent Search must have indexed the account in the target language. Intelligent Search API (Legacy) previously read this from `segment.cultureInfo`. In v1, pass the value directly as a query parameter. + */ +export const zLocale = z.union([ + z.string(), + z.null() +]); + +/** + * Defines the pricing and availability simulation behavior. + * + * - `default`: Calls the simulation for every single seller. + * - `skip`: Never calls the simulation. Use for the fastest response when live pricing is not required. + * - `only1P`: Only calls the simulation for first-party sellers. + * - `only3P`: Only calls the simulation for third-party sellers. + * - `regionalize1p`: Calls regionalized simulation for first-party sellers only. + */ +export const zSimulationBehavior = z.enum([ + 'default', + 'skip', + 'only1P', + 'only3P', + 'regionalize1p' +]); + +/** + * Defines whether the result should hide unavailable items (`true`) or not (`false`). When set to `true`, only products with stock are returned. + */ +export const zHideUnavailableItems = z.boolean().default(false); + +/** + * Sales channel (trade policy) ID. Alternative to including `trade-policy/{id}` in the facets path. Intelligent Search API (Legacy) previously read this from `segment.channel`. In v1, pass the value directly as a query parameter. + */ +export const zSc = z.string(); + +/** + * Region ID for regionalized results. Intelligent Search API (Legacy) previously read this from `segment.regionId`. In v1, pass the value directly as a query parameter. + */ +export const zRegionId = z.string(); + +/** + * Three-letter country code in [ISO 3166 ALPHA-3](https://www.iban.com/country-codes) format. Intelligent Search API (Legacy) previously read this from `segment.countryCode` or the `country` key in `segment.facets`. In v1, pass the value directly as a query parameter. + */ +export const zCountry = z.string(); + +/** + * ZIP or postal code. Intelligent Search API (Legacy) previously read this from the `zip-code` key in `segment.facets`. In v1, pass the value directly as a query parameter. + */ +export const zZipCode = z.string(); + +/** + * Geographic coordinates in the format `longitude,latitude`. Intelligent Search API (Legacy) previously read this from the `coordinates` key in `segment.facets`. In v1, pass the value directly as a query parameter. + */ +export const zCoordinates = z.string(); + +/** + * Pickup point ID for pickup-in-point delivery context. Intelligent Search API (Legacy) previously read this from the `pickupPoint` key in `segment.facets`. In v1, pass the value directly as a query parameter. + */ +export const zPickupPoint = z.string(); + +/** + * Pre-computed delivery zones hash for faster regionalization lookup. Obtain this value from the `POST` [Search delivery zones](https://developers.vtex.com/docs/api-reference/delivery-promise-suggestions-api#post-/api/logistics-shipping/delivery-zones/_search/v2) endpoint of the Delivery Promise Suggestions API. Intelligent Search API (Legacy) previously read this from the `deliveryZonesHash` key in `segment.facets`. In v1, pass the value directly as a query parameter. + */ +export const zDeliveryZonesHash = z.string(); + +/** + * Pre-computed pickup points hash for faster regionalization lookup. Obtain this value from the `POST` [Search pickup points](https://developers.vtex.com/docs/api-reference/delivery-promise-suggestions-api#post-/api/logistics-shipping/pickuppoints/_search) endpoint of the Delivery Promise Suggestions API. Intelligent Search API (Legacy) previously read this from the `pickupPointsHash` key in `segment.facets`. In v1, pass the value directly as a query parameter. + */ +export const zPickupPointsHash = z.string(); + +/** + * UTM source value, forwarded to the pricing and availability simulation. Intelligent Search API (Legacy) previously read this from `segment.utm_source`. In v1, pass the value directly as a query parameter. + */ +export const zUtmSource = z.string(); + +/** + * UTM campaign value, forwarded to the pricing and availability simulation. Intelligent Search API (Legacy) previously read this from `segment.utm_campaign`. In v1, pass the value directly as a query parameter. + */ +export const zUtmCampaign = z.string(); + +/** + * UTMi campaign value, forwarded to the pricing and availability simulation. Intelligent Search API (Legacy) previously read this from `segment.utmi_campaign`. In v1, pass the value directly as a query parameter. + */ +export const zUtmiCampaign = z.string(); + +/** + * Campaign identifier, forwarded to the pricing and availability simulation. Intelligent Search API (Legacy) previously read this from `segment.campaigns`. In v1, pass the value directly as a query parameter. + */ +export const zCampaigns = z.string(); + +/** + * Price table(s) to apply during simulation. Intelligent Search API (Legacy) previously read this from `segment.priceTables`. In v1, pass the value directly as a query parameter. + */ +export const zPriceTables = z.string(); + +/** + * Amount of sponsored products to be returned. Applicable only to merchants using [VTEX Ads](https://developers.vtex.com/docs/guides/vtex-ads). + */ +export const zSponsoredCount = z.string(); + +/** + * Advertisement placement. Applicable only to merchants using [VTEX Ads](https://developers.vtex.com/docs/guides/vtex-ads). + */ +export const zAdvertisementPlacement = z.enum([ + 'top_search', + 'middle_search', + 'search_shelf', + 'cart_shelf', + 'plp_shelf', + 'autocomplete', + 'homepage' +]); + +/** + * When `true`, the same product can appear as both sponsored and organic. When `false`, sponsored products are removed from the organic list. Applicable only to merchants using [VTEX Ads](https://developers.vtex.com/docs/guides/vtex-ads). + */ +export const zRepeatSponsoredProducts = z.boolean(); + +/** + * Indicates how the search engine will correct misspelled words by using fuzzy logic. It can be a number representing the max number of misspelled letters, or the string `auto` suggesting that the search engine should set this value by itself. + */ +export const zFuzzy = z.string(); + +/** + * Indicates how the search engine will deal with the full-text query if there is more than one word. Set `and` if the returned products must have all the words in its metadata, or `or` otherwise. + */ +export const zOperator = z.enum(['and', 'or']); + +export const zGetTopSearchesData = z.object({ + body: z.optional(z.never()), + path: z.optional(z.never()), + query: z.optional(z.object({ + locale: z.optional(z.union([ + z.string(), + z.null() + ])) + })) +}); + +export const zGetAutocompleteSuggestionsData = z.object({ + body: z.optional(z.never()), + path: z.optional(z.never()), + query: z.optional(z.object({ + query: z.optional(z.string()), + locale: z.optional(z.union([ + z.string(), + z.null() + ])) + })) +}); + +export const zGetSearchSuggestionsData = z.object({ + body: z.optional(z.never()), + path: z.optional(z.never()), + query: z.optional(z.object({ + query: z.optional(z.string()), + locale: z.optional(z.union([ + z.string(), + z.null() + ])) + })) +}); + +export const zGetCorrectionSearchData = z.object({ + body: z.optional(z.never()), + path: z.optional(z.never()), + query: z.optional(z.object({ + query: z.optional(z.string()), + locale: z.optional(z.union([ + z.string(), + z.null() + ])) + })) +}); + +export const zGetBannersByFacetsData = z.object({ + body: z.optional(z.never()), + path: z.object({ + facets: z.union([ + z.string().default('/'), + z.null() + ]).default('/') + }), + query: z.optional(z.object({ + query: z.optional(z.string()), + locale: z.optional(z.union([ + z.string(), + z.null() + ])) + })) +}); + +export const zGetProductSearchByFacetsData = z.object({ + body: z.optional(z.never()), + path: z.object({ + facets: z.union([ + z.string().default('/'), + z.null() + ]).default('/') + }), + query: z.optional(z.object({ + query: z.optional(z.string()), + count: z.optional(z.union([ + z.number().default(24), + z.null() + ])).default(24), + page: z.optional(z.union([ + z.number().default(1), + z.null() + ])).default(1), + sort: z.optional(z.nullable(z.enum([ + 'price:desc', + 'price:asc', + 'orders:desc', + 'name:desc', + 'name:asc', + 'release:desc', + 'discount:desc' + ]))), + locale: z.optional(z.union([ + z.string(), + z.null() + ])), + hideUnavailableItems: z.optional(z.boolean()).default(false), + simulationBehavior: z.optional(z.enum([ + 'default', + 'skip', + 'only1P', + 'only3P', + 'regionalize1p' + ])), + sc: z.optional(z.string()), + regionId: z.optional(z.string()), + country: z.optional(z.string()), + 'zip-code': z.optional(z.string()), + coordinates: z.optional(z.string()), + pickupPoint: z.optional(z.string()), + deliveryZonesHash: z.optional(z.string()), + pickupPointsHash: z.optional(z.string()), + utmSource: z.optional(z.string()), + utmCampaign: z.optional(z.string()), + utmiCampaign: z.optional(z.string()), + campaigns: z.optional(z.string()), + priceTables: z.optional(z.string()), + showSponsored: z.optional(z.union([ + z.boolean().default(false), + z.null() + ])).default(false), + sponsoredCount: z.optional(z.string()), + advertisementPlacement: z.optional(z.enum([ + 'top_search', + 'middle_search', + 'search_shelf', + 'cart_shelf', + 'plp_shelf', + 'autocomplete', + 'homepage' + ])), + repeatSponsoredProducts: z.optional(z.boolean()) + })) +}); + +export const zGetFacetsByFacetsData = z.object({ + body: z.optional(z.never()), + path: z.object({ + facets: z.union([ + z.string().default('/'), + z.null() + ]).default('/') + }), + query: z.optional(z.object({ + query: z.optional(z.string()), + locale: z.optional(z.union([ + z.string(), + z.null() + ])), + hideUnavailableItems: z.optional(z.boolean()).default(false), + removeHiddenFacets: z.optional(z.union([ + z.boolean(), + z.null() + ])), + sc: z.optional(z.string()), + regionId: z.optional(z.string()), + country: z.optional(z.string()), + 'zip-code': z.optional(z.string()), + coordinates: z.optional(z.string()), + pickupPoint: z.optional(z.string()), + deliveryZonesHash: z.optional(z.string()), + pickupPointsHash: z.optional(z.string()) + })) +}); + +export const zGetProductsData = z.object({ + body: z.optional(z.never()), + path: z.optional(z.never()), + query: z.object({ + sc: z.string(), + value: z.string(), + field: z.optional(z.enum([ + 'id', + 'slug', + 'ean', + 'sku', + 'reference' + ])), + locale: z.optional(z.union([ + z.string(), + z.null() + ])), + simulationBehavior: z.optional(z.enum([ + 'default', + 'skip', + 'only1P', + 'only3P', + 'regionalize1p' + ])), + hideUnavailableItems: z.optional(z.boolean()).default(false), + productClusterId: z.optional(z.string()), + productOriginVtex: z.optional(z.boolean()), + 'show-invisible-items': z.optional(z.boolean()), + regionId: z.optional(z.string()), + country: z.optional(z.string()), + 'zip-code': z.optional(z.string()), + coordinates: z.optional(z.string()), + pickupPoint: z.optional(z.string()), + deliveryZonesHash: z.optional(z.string()), + pickupPointsHash: z.optional(z.string()), + utmSource: z.optional(z.string()), + utmCampaign: z.optional(z.string()), + utmiCampaign: z.optional(z.string()), + campaigns: z.optional(z.string()), + priceTables: z.optional(z.string()) + }) +}); + +export const zGetPickupPointAvailabilityByFacetsData = z.object({ + body: z.optional(z.never()), + path: z.object({ + facets: z.union([ + z.string().default('/'), + z.null() + ]).default('/') + }), + query: z.optional(z.object({ + query: z.optional(z.string()), + locale: z.optional(z.union([ + z.string(), + z.null() + ])), + deliveryZonesHash: z.optional(z.string()), + pickupPointsHash: z.optional(z.string()), + country: z.optional(z.string()), + 'zip-code': z.optional(z.string()), + coordinates: z.optional(z.string()), + pickupPoint: z.optional(z.string()) + })) +}); diff --git a/vtex/server/generated/intelligent-search/sdk.gen.ts b/vtex/server/generated/intelligent-search/sdk.gen.ts index 48e3a84f..8d9eb0dd 100644 --- a/vtex/server/generated/intelligent-search/sdk.gen.ts +++ b/vtex/server/generated/intelligent-search/sdk.gen.ts @@ -25,6 +25,8 @@ export type Optionsℹ️ Migrate to [Intelligent Search API v1](https://developers.vtex.com/docs/api-reference/intelligent-search-api-v1) for HTTP caching, lower latency, and a simpler URL structure. The new endpoint is: `GET` [Get list of the 10 most searched terms](https://developers.vtex.com/docs/api-reference/intelligent-search-api-v1#get-/top-searches). See the [migration guide](https://developers.vtex.com/docs/guides/migrating-to-intelligent-search-api-v1). + * * ## Permissions * * This endpoint does not require [authentication](https://developers.vtex.com/docs/guides/authentication) or [permissions](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3). @@ -38,6 +40,8 @@ export const getTopSearches = (options?: O * * For more information, check the Intelligent Search [Autocomplete](https://help.vtex.com/en/tracks/vtex-intelligent-search--19wrbB7nEQcmwzDPl1l4Cb/4gXFsEWjF7QF7UtI2GAvhL) guide. * + * >ℹ️ Migrate to [Intelligent Search API v1](https://developers.vtex.com/docs/api-reference/intelligent-search-api-v1) for HTTP caching, lower latency, and a simpler URL structure. The new endpoint is: `GET` [Get list of suggested terms and attributes similar to the search term](https://developers.vtex.com/docs/api-reference/intelligent-search-api-v1#get-/autocomplete-suggestions). See the [migration guide](https://developers.vtex.com/docs/guides/migrating-to-intelligent-search-api-v1). + * * ## Permissions * * This endpoint does not require [authentication](https://developers.vtex.com/docs/guides/authentication) or [permissions](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3). @@ -49,6 +53,8 @@ export const getAutocompleteSuggestions = * * Tries to correct a misspelled term from the search. * + * >ℹ️ Migrate to [Intelligent Search API v1](https://developers.vtex.com/docs/api-reference/intelligent-search-api-v1) for HTTP caching, lower latency, and a simpler URL structure. The new endpoint is: `GET` [Get attempt of correction of a misspelled term](https://developers.vtex.com/docs/api-reference/intelligent-search-api-v1#get-/correction-search). See the [migration guide](https://developers.vtex.com/docs/guides/migrating-to-intelligent-search-api-v1). + * * ## Permissions * * This endpoint does not require [authentication](https://developers.vtex.com/docs/guides/authentication) or [permissions](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3). @@ -60,6 +66,8 @@ export const getCorrectionSearch = (option * * Lists the banners registered for a given query. Check the [configuring banners documentation](https://help.vtex.com/en/tracks/vtex-intelligent-search--19wrbB7nEQcmwzDPl1l4Cb/4ViKEivLJtJsvpaW0aqIQ5) for a full explanation of the banner feature. * + * >ℹ️ Migrate to [Intelligent Search API v1](https://developers.vtex.com/docs/api-reference/intelligent-search-api-v1) for HTTP caching, lower latency, and a simpler URL structure. The new endpoint is: `GET` [Get list of banners registered for query](https://developers.vtex.com/docs/api-reference/intelligent-search-api-v1#get-/banners/-facets-). See the [migration guide](https://developers.vtex.com/docs/guides/migrating-to-intelligent-search-api-v1). + * * ## Permissions * * This endpoint does not require [authentication](https://developers.vtex.com/docs/guides/authentication) or [permissions](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3). @@ -73,6 +81,8 @@ export const getBannersByFacets = (options * * For more information, check the Intelligent Search [Autocomplete](https://help.vtex.com/en/tracks/vtex-intelligent-search--19wrbB7nEQcmwzDPl1l4Cb/4gXFsEWjF7QF7UtI2GAvhL) guide. * + * >ℹ️ Migrate to [Intelligent Search API v1](https://developers.vtex.com/docs/api-reference/intelligent-search-api-v1) for HTTP caching, lower latency, and a simpler URL structure. The new endpoint is: `GET` [Get list of suggested terms similar to the search term](https://developers.vtex.com/docs/api-reference/intelligent-search-api-v1#get-/search-suggestions). See the [migration guide](https://developers.vtex.com/docs/guides/migrating-to-intelligent-search-api-v1). + * * ## Permissions * * This endpoint does not require [authentication](https://developers.vtex.com/docs/guides/authentication) or [permissions](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3). @@ -84,10 +94,26 @@ export const getSearchSuggestions = (optio * * Lists the active products for a given query. * + * >ℹ️ Migrate to [Intelligent Search API v1](https://developers.vtex.com/docs/api-reference/intelligent-search-api-v1) for HTTP caching (`Cache-Control: public, max-age=600`), lower latency, and explicit regionalization without relying on the segment cookie. The new endpoint is: `GET` [Search products](https://developers.vtex.com/docs/api-reference/intelligent-search-api-v1#get-/product-search/-facets-). If you need to look up a single product by a known identifier (for a product detail page), use the new `GET` [Get product](https://developers.vtex.com/docs/api-reference/intelligent-search-api-v1#get-/products) endpoint. It skips the search pipeline entirely, reducing latency and improving cache-hit rates. See the [migration guide](https://developers.vtex.com/docs/guides/migrating-to-intelligent-search-api-v1). + * * >⚠️ **Required facet:** Only the `trade-policy` facet is required in the path. All other facets (such as `productClusterIds`, `category`, `color`, etc.) are optional filters that can be used to narrow down the search results. When no additional facets are provided, all products for the trade policy will be returned. * * >⚠️ When possible, use the store's production domain in the URL (for example, `https://apiexamples.com/api/io/_v/api/intelligent-search`) for a better performance. This is particularly important for headless integrations. In case it's not possible to use the store's production URL, prefer using `https://{accountName}.vtexcommercestable.com.br/api/io/_v/api/intelligent-search`. * + * If using this option in a fully headless store with no store domain configured, follow these steps: + * 1. Configure a domain by following the [Configuring the store domain](https://help.vtex.com/docs/tutorials/configuring-the-store-domain) guide. + * 2. Send the `Host` header with the configured domain: + * ```sh + * curl --location 'https://{accountName}.vtexcommercestable.com.br/api/io/_v/api/intelligent-search/product_search/' \ + * --header 'Accept: application/json' \ + * --header 'Content-Type: application/json' \ + * --header 'Host: {configured domain}' + * ``` + * + * ## Sponsored products (VTEX Ads) + * + * The query parameters **`showSponsored`**, **`sponsoredCount`**, **`advertisementPlacement`**, and **`repeatSponsoredProducts`** apply only to stores using [VTEX Ads](https://developers.vtex.com/docs/guides/vtex-ads). See each parameter for behavior details. + * * ## Permissions * * This endpoint does not require [authentication](https://developers.vtex.com/docs/guides/authentication) or [permissions](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3). @@ -99,9 +125,19 @@ export const getProductSearchByFacets = (o * * Lists the possible facets for a given query. * - * >⚠️ When possible, use the store's production domain in the URL (for example, `https://apiexamples.com/api/io/_v/api/intelligent-search`) for a better performance. This is particularly important for headless integrations. In case it's not possible to use the store's production URL, prefer using `https://{accountName}.vtexcommercestable.com.br/api/io/_v/api/intelligent-search`. + * >ℹ️ Migrate to [Intelligent Search API v1](https://developers.vtex.com/docs/api-reference/intelligent-search-api-v1) for HTTP caching (`Cache-Control: public, max-age=600`), lower latency, and explicit regionalization without relying on the segment cookie. The new endpoint is: `GET` [List filters for a search](https://developers.vtex.com/docs/api-reference/intelligent-search-api-v1#get-/facets/-facets-). See the [migration guide](https://developers.vtex.com/docs/guides/migrating-to-intelligent-search-api-v1). * + * >⚠️ When possible, use the store's production domain in the URL (for example, `https://apiexamples.com/api/io/_v/api/intelligent-search`) for a better performance. This is particularly important for headless integrations. In case it's not possible to use the store's production URL, prefer using `https://{accountName}.vtexcommercestable.com.br/api/io/_v/api/intelligent-search`. * + * If using this option in a fully headless store with no store domain configured, follow these steps: + * 1. Configure a domain by following the [Configuring the store domain](https://help.vtex.com/docs/tutorials/configuring-the-store-domain) guide. + * 2. Send the `Host` header with the configured domain: + * ```sh + * curl --location 'https://{accountName}.vtexcommercestable.com.br/api/io/_v/api/intelligent-search/facets/' \ + * --header 'Accept: application/json' \ + * --header 'Content-Type: application/json' \ + * --header 'Host: {configured domain}' + * ``` * * ## Permissions * @@ -114,6 +150,8 @@ export const getFacetsByFacets = (options: * * Retrieves the list of available pickup points with their IDs, distances, addresses, and business hours. This endpoint returns pickup points sorted by distance from the provided coordinates. * + * >ℹ️ Migrate to [Intelligent Search API v1](https://developers.vtex.com/docs/api-reference/intelligent-search-api-v1) for HTTP caching and lower latency. The new endpoint is: `GET` [Get pickup point availability for Delivery Promise](https://developers.vtex.com/docs/api-reference/intelligent-search-api-v1#get-/pickup-point-availability/-facets-). See the [migration guide](https://developers.vtex.com/docs/guides/migrating-to-intelligent-search-api-v1). + * * >⚠️ **Required facet:** Only the `tradePolicy` (trade policy/sales channel) facet is required. All product filters, including `productClusterIds`, are optional and can be provided as query parameters to narrow down the results. When no product filters are provided, all available pickup points for the trade policy will be returned. * * >ℹ️ This endpoint is designed for use in [Delivery Promise for headless stores](https://developers.vtex.com/docs/guides/delivery-promise-for-headless-stores) implementations. It provides the complete list of pickup points required as a mandatory dependency for the [Delivery Promise feature](https://help.vtex.com/en/docs/tutorials/delivery-promise-beta). The system displays all available pickup points within the 50 km radius configured in Checkout when customers select pickup in the header or a specific pickup point. @@ -121,7 +159,7 @@ export const getFacetsByFacets = (options: * You can call this endpoint in two ways: * * - **With country and ZIP code:** Provide the country and ZIP code to retrieve pickup points based on location. - * - **With delivery zones and pickups hashes:** Alternatively, provide pre-computed hashes (`deliveryZonesHash` and `pickupsHash`) for faster lookup. + * - **With delivery zones and pickup point hashes:** Alternatively, provide pre-computed hashes (`deliveryZonesHash` and `pickupPointsHash`) for faster lookup. * * ## Permissions * diff --git a/vtex/server/generated/intelligent-search/types.gen.ts b/vtex/server/generated/intelligent-search/types.gen.ts index 88f12d2e..3ba53166 100644 --- a/vtex/server/generated/intelligent-search/types.gen.ts +++ b/vtex/server/generated/intelligent-search/types.gen.ts @@ -263,6 +263,35 @@ export type ProductSearch = { * Defines whether the list of products was translated by Intelligent Search (`true`) or not (`false`). */ translated?: boolean; + /** + * Redirect URL when the query maps to a configured redirect rule. Present only when a redirect applies. + */ + redirect?: string | null; + /** + * Search options available for the query. + */ + options?: { + /** + * Available sort options. + */ + sorts?: Array<{ + [key: string]: unknown; + }>; + /** + * Available product count options. + */ + counts?: Array<{ + [key: string]: unknown; + }>; + /** + * Whether Delivery Promise features are enabled for this query. + */ + deliveryPromisesEnabled?: boolean; + }; + /** + * Unique identifier for the search session. Use this value when sending search analytics events. + */ + searchId?: string; /** * Pagination information. */ @@ -1320,11 +1349,13 @@ export type Facets = { href?: string; }>; /** - * Facet type - * - `TEXT` - The value is a simple text. - * - `PRICERANGE` - The value contains the property `range` representing the minimum and the maximum price for the query. + * Facet type, which can be: + * + * - `TEXT`: The value is a simple text. + * - `PRICERANGE`: The value contains the property `range` representing the minimum and the maximum price for the query. + * - `DELIVERY`: The value represents a delivery option. Only appears in searches using [Delivery Promise](https://help.vtex.com/docs/tutorials/delivery-promise-beta). */ - type?: 'TEXT' | 'PRICERANGE'; + type?: 'TEXT' | 'PRICERANGE' | 'DELIVERY'; /** * Human-readable format of the facet key. */ @@ -1389,6 +1420,34 @@ export type Facets = { /** * Search term. It can contain any character. + * + * This parameter is named `query` in the API. The short form **`q`** is an alias for `query` and has the same semantics. + * + * You can search for products or SKUs using specific ID types by adding search parameters (query) at the end of the store URL, respecting one of the following structures: + * + * - **Single item search:** `?query=[id type]:[id_1]`. Example: `?query=product:98765` + * - **Multiple items search:** `?query=[id type]:[id_1];[id_2];[id_3]`. Example: `?query=product:98765;98743` + * + * >⚠️ All searched IDs should be of the same type. + * + * ## Search by ID + * + * On the Intelligent Search API, search products or SKUs by ID by sending the value in the `query` or `q` query parameter on requests such as `/product_search/{facets}`. The `{facets}` path must include the required `trade-policy` facet and any optional filters. + * + * - **Product ID:** `.../product_search/trade-policy/1?query=product:98765` or `.../product_search/trade-policy/1?query=product.id:98765`. + * - **SKU ID:** `.../product_search/trade-policy/1?query=sku.id:12345` or `.../product_search/trade-policy/1?query=sku:12345`. + * + * ## Supported ID types + * + * The possible value types for the ID segment are `product.id`, `sku.id`, `sku.ean`, `sku.reference`, `product.link`, or `id` (ProductID, ProductRefID, SKUID, SKURefID, and EAN). + * + * | ID Type | Query format | Example | + * | - | - | - | + * | Product ID | `?query=product:` or `?query=product.id:` | `?query=product:98765` | + * | SKU ID | `?query=sku:` or `?query=sku.id:` | `?query=sku.id:12345` | + * | Reference ID | `?query=sku.reference:` | `?query=sku.reference:REF123` | + * | EAN | `?query=sku.ean:` | `?query=sku.ean:7891234567890` | + * | Slug | `?query=product.link:` | `?query=product.link:blue-shirt` | */ export type Query = string; @@ -1403,32 +1462,46 @@ export type Query = string; * * You can also repeat the same `facetKey` several times for different values. For example: `category-1/shoes/color/blue/color/red/color/yellow`. * + * ## Filter combinations + * + * When shoppers apply filters, the API combines them according to the following rules: + * + * - **Facets of the same type → OR (union):** When multiple values of the same facet are applied, the API returns the union of all products matching any of those values. + * - **Facets of different types → AND (intersection):** When different facet types are combined, the API returns only the products that satisfy all selected facet conditions simultaneously. + * + * ## Negative filters (NOT operator) + * + * To exclude a facet value, prefix the value with **`not:`** in the path segment: `/{facetKey}/not:{facetValue}/`. For example, `color/blue/size/not:42` keeps color blue and excludes size 42. Use the same `not:` prefix with the facet keys and values configured in your catalog. This supports use cases such as including products in one collection but excluding another. + * + * The NOT operator excludes specific values. The OR and AND rules in **Filter combinations** still describe how multiple positive facet selections combine. + * * ## Available filters * * The `facets` parameter allows the following filters: * * | `facetKey` | Description | Example | * | - | - | - | - * | `trade-policy` **(required)** | Filter the search by trade policy (also known as sales channel), following the format `trade-policy/{tradePolicyId}`. | `trade-policy/2` | - * | `price` *(optional)* | Filter the search by a price range, following the format `${minPrice}:${maxPrice}`. | `/color/blue/price/100:500?query=shirt` | - * | `category-${n}` *(optional)* | Filter the search by category, where `n` represents the category tree level (1 = department, 2 = category, 3 = subcategory, and so on). | `category-1/clothing/category-2/shirts` | - * | `productClusterIds` *(optional)* | Filter the search by collection, following the format `productClusterIds/{collectionId}`. | `productClusterIds/262` | - * + * | `trade-policy` **(required)** | Filter by trade policy (sales channel) using `trade-policy/{tradePolicyId}`. Some integrations use the `salesChannel` query string for the same purpose when supported. | `trade-policy/2` | + * | `category-${n}` *(optional)* | Filter the search by category, where n represents the category tree level (1 = department, 2 = category, 3 = subcategory, and so on). Declare the full path from the root level through every parent down to the level you need. For example, using only `category-2/shirts` without the `category-1/...` segment is incorrect. | `category-1/clothing/category-2/shirts` | + * | `brand` *(optional)* | Filter by brand slug or identifier. | `brand/acme` | + * | `{specificationName}` *(optional)* | Filter by a catalog specification exposed as a search filter, using `{specificationName}/{specificationValue}` (for example `color/blue`). | `color/blue` | + * | `productClusterIds` *(optional)* | Filter by collection ID. | `productClusterIds/262` | + * | `price` *(optional)* | Filter by price range `${minPrice}:${maxPrice}`. | `trade-policy/1/color/blue/price/100:500` (with `?query=shirt` on the full URL when using a text query). | */ export type FacetsPath = string | null; /** - * Amount of sponsored products to be returned. Applicable only to merchants using [VTEX Ad Network](https://help.vtex.com/en/tutorial/vtex-ad-network-beta--2cgqXcBuJmXN2livQvClur). + * Amount of sponsored products to be returned. Applicable only to merchants using [VTEX Ads](https://developers.vtex.com/docs/guides/vtex-ads). */ export type SponsoredCount = string; /** - * Advertisement placement. Applicable only to merchants using [VTEX Ad Network](https://help.vtex.com/en/tutorial/vtex-ad-network-beta--2cgqXcBuJmXN2livQvClur). + * Advertisement placement. Applicable only to merchants using [VTEX Ads](https://developers.vtex.com/docs/guides/vtex-ads). */ export type AdvertisementPlacement = 'top_search' | 'middle_search' | 'search_shelf' | 'cart_shelf' | 'plp_shelf' | 'autocomplete' | 'homepage'; /** - * Defines if sponsored products can appear again as organic listings. When set as `true`, it allows the same product to be shown as both sponsored and organic. When set as `false`, it removes duplicates, ensuring a sponsored product does not appear again as organic. Applicable only to merchants using [VTEX Ad Network](https://help.vtex.com/en/tutorial/vtex-ad-network-beta--2cgqXcBuJmXN2livQvClur). + * Defines if sponsored products can appear again as organic listings. When set as `true`, it allows the same product to be shown as both sponsored and organic. When set as `false`, it removes duplicates, ensuring a sponsored product does not appear again as organic. Applicable only to merchants using [VTEX Ads](https://developers.vtex.com/docs/guides/vtex-ads). */ export type RepeatSponsoredProducts = boolean; @@ -1442,9 +1515,11 @@ export type Locale = string | null; * * * `default` - Calls the simulation for every single seller. * * `skip` - Never calls the simulation. - * * `only1P` - Only calls the simulation for first party sellers. + * * `only1P` - Only calls the simulation for first-party sellers. + * * `only3P` - Only calls the simulation for third-party sellers. + * * `regionalize1p` - Calls regionalized simulation for first-party sellers only. */ -export type SimulationBehavior = 'default' | 'skip' | 'only1P'; +export type SimulationBehavior = 'default' | 'skip' | 'only1P' | 'only3P' | 'regionalize1p'; /** * Defines whether the result should hide unavailable items (`true`), or not (`false`). When set to `true`, only products with stock are returned; when set to `false`, the API includes unavailable products as well. A product is considered unavailable when `availableQuantity = 0`, while `availableQuantity = 10000` indicates that the product is available. Retailers may choose to show unavailable items for commercial reasons (for example, to signal that they offer those products even if temporarily out-of-stock). The recommended default is `true`. @@ -1488,6 +1563,34 @@ export type GetAutocompleteSuggestionsData = { query?: { /** * Search term. It can contain any character. + * + * This parameter is named `query` in the API. The short form **`q`** is an alias for `query` and has the same semantics. + * + * You can search for products or SKUs using specific ID types by adding search parameters (query) at the end of the store URL, respecting one of the following structures: + * + * - **Single item search:** `?query=[id type]:[id_1]`. Example: `?query=product:98765` + * - **Multiple items search:** `?query=[id type]:[id_1];[id_2];[id_3]`. Example: `?query=product:98765;98743` + * + * >⚠️ All searched IDs should be of the same type. + * + * ## Search by ID + * + * On the Intelligent Search API, search products or SKUs by ID by sending the value in the `query` or `q` query parameter on requests such as `/product_search/{facets}`. The `{facets}` path must include the required `trade-policy` facet and any optional filters. + * + * - **Product ID:** `.../product_search/trade-policy/1?query=product:98765` or `.../product_search/trade-policy/1?query=product.id:98765`. + * - **SKU ID:** `.../product_search/trade-policy/1?query=sku.id:12345` or `.../product_search/trade-policy/1?query=sku:12345`. + * + * ## Supported ID types + * + * The possible value types for the ID segment are `product.id`, `sku.id`, `sku.ean`, `sku.reference`, `product.link`, or `id` (ProductID, ProductRefID, SKUID, SKURefID, and EAN). + * + * | ID Type | Query format | Example | + * | - | - | - | + * | Product ID | `?query=product:` or `?query=product.id:` | `?query=product:98765` | + * | SKU ID | `?query=sku:` or `?query=sku.id:` | `?query=sku.id:12345` | + * | Reference ID | `?query=sku.reference:` | `?query=sku.reference:REF123` | + * | EAN | `?query=sku.ean:` | `?query=sku.ean:7891234567890` | + * | Slug | `?query=product.link:` | `?query=product.link:blue-shirt` | */ query?: string; /** @@ -1513,6 +1616,34 @@ export type GetCorrectionSearchData = { query?: { /** * Search term. It can contain any character. + * + * This parameter is named `query` in the API. The short form **`q`** is an alias for `query` and has the same semantics. + * + * You can search for products or SKUs using specific ID types by adding search parameters (query) at the end of the store URL, respecting one of the following structures: + * + * - **Single item search:** `?query=[id type]:[id_1]`. Example: `?query=product:98765` + * - **Multiple items search:** `?query=[id type]:[id_1];[id_2];[id_3]`. Example: `?query=product:98765;98743` + * + * >⚠️ All searched IDs should be of the same type. + * + * ## Search by ID + * + * On the Intelligent Search API, search products or SKUs by ID by sending the value in the `query` or `q` query parameter on requests such as `/product_search/{facets}`. The `{facets}` path must include the required `trade-policy` facet and any optional filters. + * + * - **Product ID:** `.../product_search/trade-policy/1?query=product:98765` or `.../product_search/trade-policy/1?query=product.id:98765`. + * - **SKU ID:** `.../product_search/trade-policy/1?query=sku.id:12345` or `.../product_search/trade-policy/1?query=sku:12345`. + * + * ## Supported ID types + * + * The possible value types for the ID segment are `product.id`, `sku.id`, `sku.ean`, `sku.reference`, `product.link`, or `id` (ProductID, ProductRefID, SKUID, SKURefID, and EAN). + * + * | ID Type | Query format | Example | + * | - | - | - | + * | Product ID | `?query=product:` or `?query=product.id:` | `?query=product:98765` | + * | SKU ID | `?query=sku:` or `?query=sku.id:` | `?query=sku.id:12345` | + * | Reference ID | `?query=sku.reference:` | `?query=sku.reference:REF123` | + * | EAN | `?query=sku.ean:` | `?query=sku.ean:7891234567890` | + * | Slug | `?query=product.link:` | `?query=product.link:blue-shirt` | */ query?: string; /** @@ -1546,23 +1677,65 @@ export type GetBannersByFacetsData = { * * You can also repeat the same `facetKey` several times for different values. For example: `category-1/shoes/color/blue/color/red/color/yellow`. * + * ## Filter combinations + * + * When shoppers apply filters, the API combines them according to the following rules: + * + * - **Facets of the same type → OR (union):** When multiple values of the same facet are applied, the API returns the union of all products matching any of those values. + * - **Facets of different types → AND (intersection):** When different facet types are combined, the API returns only the products that satisfy all selected facet conditions simultaneously. + * + * ## Negative filters (NOT operator) + * + * To exclude a facet value, prefix the value with **`not:`** in the path segment: `/{facetKey}/not:{facetValue}/`. For example, `color/blue/size/not:42` keeps color blue and excludes size 42. Use the same `not:` prefix with the facet keys and values configured in your catalog. This supports use cases such as including products in one collection but excluding another. + * + * The NOT operator excludes specific values. The OR and AND rules in **Filter combinations** still describe how multiple positive facet selections combine. + * * ## Available filters * * The `facets` parameter allows the following filters: * * | `facetKey` | Description | Example | * | - | - | - | - * | `trade-policy` **(required)** | Filter the search by trade policy (also known as sales channel), following the format `trade-policy/{tradePolicyId}`. | `trade-policy/2` | - * | `price` *(optional)* | Filter the search by a price range, following the format `${minPrice}:${maxPrice}`. | `/color/blue/price/100:500?query=shirt` | - * | `category-${n}` *(optional)* | Filter the search by category, where `n` represents the category tree level (1 = department, 2 = category, 3 = subcategory, and so on). | `category-1/clothing/category-2/shirts` | - * | `productClusterIds` *(optional)* | Filter the search by collection, following the format `productClusterIds/{collectionId}`. | `productClusterIds/262` | - * + * | `trade-policy` **(required)** | Filter by trade policy (sales channel) using `trade-policy/{tradePolicyId}`. Some integrations use the `salesChannel` query string for the same purpose when supported. | `trade-policy/2` | + * | `category-${n}` *(optional)* | Filter the search by category, where n represents the category tree level (1 = department, 2 = category, 3 = subcategory, and so on). Declare the full path from the root level through every parent down to the level you need. For example, using only `category-2/shirts` without the `category-1/...` segment is incorrect. | `category-1/clothing/category-2/shirts` | + * | `brand` *(optional)* | Filter by brand slug or identifier. | `brand/acme` | + * | `{specificationName}` *(optional)* | Filter by a catalog specification exposed as a search filter, using `{specificationName}/{specificationValue}` (for example `color/blue`). | `color/blue` | + * | `productClusterIds` *(optional)* | Filter by collection ID. | `productClusterIds/262` | + * | `price` *(optional)* | Filter by price range `${minPrice}:${maxPrice}`. | `trade-policy/1/color/blue/price/100:500` (with `?query=shirt` on the full URL when using a text query). | */ facets: string | null; }; query?: { /** * Search term. It can contain any character. + * + * This parameter is named `query` in the API. The short form **`q`** is an alias for `query` and has the same semantics. + * + * You can search for products or SKUs using specific ID types by adding search parameters (query) at the end of the store URL, respecting one of the following structures: + * + * - **Single item search:** `?query=[id type]:[id_1]`. Example: `?query=product:98765` + * - **Multiple items search:** `?query=[id type]:[id_1];[id_2];[id_3]`. Example: `?query=product:98765;98743` + * + * >⚠️ All searched IDs should be of the same type. + * + * ## Search by ID + * + * On the Intelligent Search API, search products or SKUs by ID by sending the value in the `query` or `q` query parameter on requests such as `/product_search/{facets}`. The `{facets}` path must include the required `trade-policy` facet and any optional filters. + * + * - **Product ID:** `.../product_search/trade-policy/1?query=product:98765` or `.../product_search/trade-policy/1?query=product.id:98765`. + * - **SKU ID:** `.../product_search/trade-policy/1?query=sku.id:12345` or `.../product_search/trade-policy/1?query=sku:12345`. + * + * ## Supported ID types + * + * The possible value types for the ID segment are `product.id`, `sku.id`, `sku.ean`, `sku.reference`, `product.link`, or `id` (ProductID, ProductRefID, SKUID, SKURefID, and EAN). + * + * | ID Type | Query format | Example | + * | - | - | - | + * | Product ID | `?query=product:` or `?query=product.id:` | `?query=product:98765` | + * | SKU ID | `?query=sku:` or `?query=sku.id:` | `?query=sku.id:12345` | + * | Reference ID | `?query=sku.reference:` | `?query=sku.reference:REF123` | + * | EAN | `?query=sku.ean:` | `?query=sku.ean:7891234567890` | + * | Slug | `?query=product.link:` | `?query=product.link:blue-shirt` | */ query?: string; /** @@ -1588,6 +1761,34 @@ export type GetSearchSuggestionsData = { query?: { /** * Search term. It can contain any character. + * + * This parameter is named `query` in the API. The short form **`q`** is an alias for `query` and has the same semantics. + * + * You can search for products or SKUs using specific ID types by adding search parameters (query) at the end of the store URL, respecting one of the following structures: + * + * - **Single item search:** `?query=[id type]:[id_1]`. Example: `?query=product:98765` + * - **Multiple items search:** `?query=[id type]:[id_1];[id_2];[id_3]`. Example: `?query=product:98765;98743` + * + * >⚠️ All searched IDs should be of the same type. + * + * ## Search by ID + * + * On the Intelligent Search API, search products or SKUs by ID by sending the value in the `query` or `q` query parameter on requests such as `/product_search/{facets}`. The `{facets}` path must include the required `trade-policy` facet and any optional filters. + * + * - **Product ID:** `.../product_search/trade-policy/1?query=product:98765` or `.../product_search/trade-policy/1?query=product.id:98765`. + * - **SKU ID:** `.../product_search/trade-policy/1?query=sku.id:12345` or `.../product_search/trade-policy/1?query=sku:12345`. + * + * ## Supported ID types + * + * The possible value types for the ID segment are `product.id`, `sku.id`, `sku.ean`, `sku.reference`, `product.link`, or `id` (ProductID, ProductRefID, SKUID, SKURefID, and EAN). + * + * | ID Type | Query format | Example | + * | - | - | - | + * | Product ID | `?query=product:` or `?query=product.id:` | `?query=product:98765` | + * | SKU ID | `?query=sku:` or `?query=sku.id:` | `?query=sku.id:12345` | + * | Reference ID | `?query=sku.reference:` | `?query=sku.reference:REF123` | + * | EAN | `?query=sku.ean:` | `?query=sku.ean:7891234567890` | + * | Slug | `?query=product.link:` | `?query=product.link:blue-shirt` | */ query?: string; /** @@ -1621,78 +1822,123 @@ export type GetProductSearchByFacetsData = { * * You can also repeat the same `facetKey` several times for different values. For example: `category-1/shoes/color/blue/color/red/color/yellow`. * + * ## Filter combinations + * + * When shoppers apply filters, the API combines them according to the following rules: + * + * - **Facets of the same type → OR (union):** When multiple values of the same facet are applied, the API returns the union of all products matching any of those values. + * - **Facets of different types → AND (intersection):** When different facet types are combined, the API returns only the products that satisfy all selected facet conditions simultaneously. + * + * ## Negative filters (NOT operator) + * + * To exclude a facet value, prefix the value with **`not:`** in the path segment: `/{facetKey}/not:{facetValue}/`. For example, `color/blue/size/not:42` keeps color blue and excludes size 42. Use the same `not:` prefix with the facet keys and values configured in your catalog. This supports use cases such as including products in one collection but excluding another. + * + * The NOT operator excludes specific values. The OR and AND rules in **Filter combinations** still describe how multiple positive facet selections combine. + * * ## Available filters * * The `facets` parameter allows the following filters: * * | `facetKey` | Description | Example | * | - | - | - | - * | `trade-policy` **(required)** | Filter the search by trade policy (also known as sales channel), following the format `trade-policy/{tradePolicyId}`. | `trade-policy/2` | - * | `price` *(optional)* | Filter the search by a price range, following the format `${minPrice}:${maxPrice}`. | `/color/blue/price/100:500?query=shirt` | - * | `category-${n}` *(optional)* | Filter the search by category, where `n` represents the category tree level (1 = department, 2 = category, 3 = subcategory, and so on). | `category-1/clothing/category-2/shirts` | - * | `productClusterIds` *(optional)* | Filter the search by collection, following the format `productClusterIds/{collectionId}`. | `productClusterIds/262` | - * + * | `trade-policy` **(required)** | Filter by trade policy (sales channel) using `trade-policy/{tradePolicyId}`. Some integrations use the `salesChannel` query string for the same purpose when supported. | `trade-policy/2` | + * | `category-${n}` *(optional)* | Filter the search by category, where n represents the category tree level (1 = department, 2 = category, 3 = subcategory, and so on). Declare the full path from the root level through every parent down to the level you need. For example, using only `category-2/shirts` without the `category-1/...` segment is incorrect. | `category-1/clothing/category-2/shirts` | + * | `brand` *(optional)* | Filter by brand slug or identifier. | `brand/acme` | + * | `{specificationName}` *(optional)* | Filter by a catalog specification exposed as a search filter, using `{specificationName}/{specificationValue}` (for example `color/blue`). | `color/blue` | + * | `productClusterIds` *(optional)* | Filter by collection ID. | `productClusterIds/262` | + * | `price` *(optional)* | Filter by price range `${minPrice}:${maxPrice}`. | `trade-policy/1/color/blue/price/100:500` (with `?query=shirt` on the full URL when using a text query). | */ facets: string | null; }; query?: { /** * Search term. It can contain any character. + * + * This parameter is named `query` in the API. The short form **`q`** is an alias for `query` and has the same semantics. + * + * You can search for products or SKUs using specific ID types by adding search parameters (query) at the end of the store URL, respecting one of the following structures: + * + * - **Single item search:** `?query=[id type]:[id_1]`. Example: `?query=product:98765` + * - **Multiple items search:** `?query=[id type]:[id_1];[id_2];[id_3]`. Example: `?query=product:98765;98743` + * + * >⚠️ All searched IDs should be of the same type. + * + * ## Search by ID + * + * On the Intelligent Search API, search products or SKUs by ID by sending the value in the `query` or `q` query parameter on requests such as `/product_search/{facets}`. The `{facets}` path must include the required `trade-policy` facet and any optional filters. + * + * - **Product ID:** `.../product_search/trade-policy/1?query=product:98765` or `.../product_search/trade-policy/1?query=product.id:98765`. + * - **SKU ID:** `.../product_search/trade-policy/1?query=sku.id:12345` or `.../product_search/trade-policy/1?query=sku:12345`. + * + * ## Supported ID types + * + * The possible value types for the ID segment are `product.id`, `sku.id`, `sku.ean`, `sku.reference`, `product.link`, or `id` (ProductID, ProductRefID, SKUID, SKURefID, and EAN). + * + * | ID Type | Query format | Example | + * | - | - | - | + * | Product ID | `?query=product:` or `?query=product.id:` | `?query=product:98765` | + * | SKU ID | `?query=sku:` or `?query=sku.id:` | `?query=sku.id:12345` | + * | Reference ID | `?query=sku.reference:` | `?query=sku.reference:REF123` | + * | EAN | `?query=sku.ean:` | `?query=sku.ean:7891234567890` | + * | Slug | `?query=product.link:` | `?query=product.link:blue-shirt` | */ query?: string; /** - * Amount of sponsored products to be returned. Applicable only to merchants using [VTEX Ad Network](https://help.vtex.com/en/tutorial/vtex-ad-network-beta--2cgqXcBuJmXN2livQvClur). + * Number of products per page. */ - sponsoredCount?: string; + count?: number | null; /** - * Advertisement placement. Applicable only to merchants using [VTEX Ad Network](https://help.vtex.com/en/tutorial/vtex-ad-network-beta--2cgqXcBuJmXN2livQvClur). + * Current search page. */ - advertisementPlacement?: 'top_search' | 'middle_search' | 'search_shelf' | 'cart_shelf' | 'plp_shelf' | 'autocomplete' | 'homepage'; + page?: number | null; + /** + * Defines how results are sorted. Relevance is Intelligent Search's **default** sorting type, used for typical product search and applied when this parameter is omitted, null or empty. Use one of the other values listed below only when you need a fixed sort instead of relevance. + * + * Allowed values: + * - **Omitted, empty, or null** (default): Results are sorted by relevance. + * - `price:desc`: Results are sorted by price in descending order, from highest to lowest. + * - `price:asc`: Results are sorted by price in ascending order, from lowest to highest. + * - `orders:desc`: Results are sorted by the amount of orders in the past 90 days, in descending order. + * - `name:desc`: Results are sorted by name in descending alphabetical order. + * - `name:asc`: Results are sorted by name in ascending alphabetical order. + * - `release:desc`: Results are sorted by release date in descending order, from most recent to least recent. + * - `discount:desc`: Results are sorted by discount percentage in descending order, from highest to lowest. + */ + sort?: 'price:desc' | 'price:asc' | 'orders:desc' | 'name:desc' | 'name:asc' | 'release:desc' | 'discount:desc' | null; /** - * Defines if sponsored products can appear again as organic listings. When set as `true`, it allows the same product to be shown as both sponsored and organic. When set as `false`, it removes duplicates, ensuring a sponsored product does not appear again as organic. Applicable only to merchants using [VTEX Ad Network](https://help.vtex.com/en/tutorial/vtex-ad-network-beta--2cgqXcBuJmXN2livQvClur). + * Indicates the target language as a BCP 47 language code. The Intelligent Search must have indexed the account in the target language. */ - repeatSponsoredProducts?: boolean; + locale?: string | null; + /** + * Defines whether the result should hide unavailable items (`true`), or not (`false`). When set to `true`, only products with stock are returned; when set to `false`, the API includes unavailable products as well. A product is considered unavailable when `availableQuantity = 0`, while `availableQuantity = 10000` indicates that the product is available. Retailers may choose to show unavailable items for commercial reasons (for example, to signal that they offer those products even if temporarily out-of-stock). The recommended default is `true`. + */ + hideUnavailableItems?: boolean; /** * Defines the simulation behavior. * * * `default` - Calls the simulation for every single seller. * * `skip` - Never calls the simulation. - * * `only1P` - Only calls the simulation for first party sellers. - */ - simulationBehavior?: 'default' | 'skip' | 'only1P'; - /** - * Number of products per page. - */ - count?: number | null; - /** - * Current search page. + * * `only1P` - Only calls the simulation for first-party sellers. + * * `only3P` - Only calls the simulation for third-party sellers. + * * `regionalize1p` - Calls regionalized simulation for first-party sellers only. */ - page?: number | null; + simulationBehavior?: 'default' | 'skip' | 'only1P' | 'only3P' | 'regionalize1p'; /** - * Defines if sponsored products are listed (`true`) or not (`false`). Applicable to stores using [VTEX Ad Network](https://help.vtex.com/en/tutorial/vtex-ad-network-beta--2cgqXcBuJmXN2livQvClur) to offer ad space. + * Defines if sponsored products are listed (`true`) or not (`false`). Applicable to stores using [VTEX Ads](https://developers.vtex.com/docs/guides/vtex-ads) to offer ad space. */ showSponsored?: boolean | null; /** - * Defines the sort type. The possible values are: - * - `price:desc`: The results will be sorted by price in descending order, from highest to lowest. - * - `price:asc`: The results will be sorted by price in ascending order, from lowest to highest. - * - `orders:desc`: The results will be sorted by the amount of orders in the past 90 days, in descending order. - * - `name:desc`: The results will be sorted by name in descending alphabetical order. - * - `name:asc`: The results will be sorted by name in ascending alphabetical order. - * - `release:desc`: The results will be sorted by release date in descending order, from most recent to least recent. - * - `discount:desc`: The results will be sorted by discount percentage in descending order, from highest to lowest. - * - * If this query parameter is not used, the products will be sorted by relevance. + * Amount of sponsored products to be returned. Applicable only to merchants using [VTEX Ads](https://developers.vtex.com/docs/guides/vtex-ads). */ - sort?: 'price:desc' | 'price:asc' | 'orders:desc' | 'name:desc' | 'name:asc' | 'release:desc' | 'discount:desc'; + sponsoredCount?: string; /** - * Indicates the target language as a BCP 47 language code. The Intelligent Search must have indexed the account in the target language. + * Advertisement placement. Applicable only to merchants using [VTEX Ads](https://developers.vtex.com/docs/guides/vtex-ads). */ - locale?: string | null; + advertisementPlacement?: 'top_search' | 'middle_search' | 'search_shelf' | 'cart_shelf' | 'plp_shelf' | 'autocomplete' | 'homepage'; /** - * Defines whether the result should hide unavailable items (`true`), or not (`false`). When set to `true`, only products with stock are returned; when set to `false`, the API includes unavailable products as well. A product is considered unavailable when `availableQuantity = 0`, while `availableQuantity = 10000` indicates that the product is available. Retailers may choose to show unavailable items for commercial reasons (for example, to signal that they offer those products even if temporarily out-of-stock). The recommended default is `true`. + * Defines if sponsored products can appear again as organic listings. When set as `true`, it allows the same product to be shown as both sponsored and organic. When set as `false`, it removes duplicates, ensuring a sponsored product does not appear again as organic. Applicable only to merchants using [VTEX Ads](https://developers.vtex.com/docs/guides/vtex-ads). */ - hideUnavailableItems?: boolean; + repeatSponsoredProducts?: boolean; }; url: '/product_search/{facets}'; }; @@ -1734,6 +1980,8 @@ export type GetProductSearchByFacetsError = GetProductSearchByFacetsErrors[keyof export type GetProductSearchByFacetsResponses = { /** + * OK + * * List of products for the given query. */ 200: ProductSearch; @@ -1755,23 +2003,65 @@ export type GetFacetsByFacetsData = { * * You can also repeat the same `facetKey` several times for different values. For example: `category-1/shoes/color/blue/color/red/color/yellow`. * + * ## Filter combinations + * + * When shoppers apply filters, the API combines them according to the following rules: + * + * - **Facets of the same type → OR (union):** When multiple values of the same facet are applied, the API returns the union of all products matching any of those values. + * - **Facets of different types → AND (intersection):** When different facet types are combined, the API returns only the products that satisfy all selected facet conditions simultaneously. + * + * ## Negative filters (NOT operator) + * + * To exclude a facet value, prefix the value with **`not:`** in the path segment: `/{facetKey}/not:{facetValue}/`. For example, `color/blue/size/not:42` keeps color blue and excludes size 42. Use the same `not:` prefix with the facet keys and values configured in your catalog. This supports use cases such as including products in one collection but excluding another. + * + * The NOT operator excludes specific values. The OR and AND rules in **Filter combinations** still describe how multiple positive facet selections combine. + * * ## Available filters * * The `facets` parameter allows the following filters: * * | `facetKey` | Description | Example | * | - | - | - | - * | `trade-policy` **(required)** | Filter the search by trade policy (also known as sales channel), following the format `trade-policy/{tradePolicyId}`. | `trade-policy/2` | - * | `price` *(optional)* | Filter the search by a price range, following the format `${minPrice}:${maxPrice}`. | `/color/blue/price/100:500?query=shirt` | - * | `category-${n}` *(optional)* | Filter the search by category, where `n` represents the category tree level (1 = department, 2 = category, 3 = subcategory, and so on). | `category-1/clothing/category-2/shirts` | - * | `productClusterIds` *(optional)* | Filter the search by collection, following the format `productClusterIds/{collectionId}`. | `productClusterIds/262` | - * + * | `trade-policy` **(required)** | Filter by trade policy (sales channel) using `trade-policy/{tradePolicyId}`. Some integrations use the `salesChannel` query string for the same purpose when supported. | `trade-policy/2` | + * | `category-${n}` *(optional)* | Filter the search by category, where n represents the category tree level (1 = department, 2 = category, 3 = subcategory, and so on). Declare the full path from the root level through every parent down to the level you need. For example, using only `category-2/shirts` without the `category-1/...` segment is incorrect. | `category-1/clothing/category-2/shirts` | + * | `brand` *(optional)* | Filter by brand slug or identifier. | `brand/acme` | + * | `{specificationName}` *(optional)* | Filter by a catalog specification exposed as a search filter, using `{specificationName}/{specificationValue}` (for example `color/blue`). | `color/blue` | + * | `productClusterIds` *(optional)* | Filter by collection ID. | `productClusterIds/262` | + * | `price` *(optional)* | Filter by price range `${minPrice}:${maxPrice}`. | `trade-policy/1/color/blue/price/100:500` (with `?query=shirt` on the full URL when using a text query). | */ facets: string | null; }; query?: { /** * Search term. It can contain any character. + * + * This parameter is named `query` in the API. The short form **`q`** is an alias for `query` and has the same semantics. + * + * You can search for products or SKUs using specific ID types by adding search parameters (query) at the end of the store URL, respecting one of the following structures: + * + * - **Single item search:** `?query=[id type]:[id_1]`. Example: `?query=product:98765` + * - **Multiple items search:** `?query=[id type]:[id_1];[id_2];[id_3]`. Example: `?query=product:98765;98743` + * + * >⚠️ All searched IDs should be of the same type. + * + * ## Search by ID + * + * On the Intelligent Search API, search products or SKUs by ID by sending the value in the `query` or `q` query parameter on requests such as `/product_search/{facets}`. The `{facets}` path must include the required `trade-policy` facet and any optional filters. + * + * - **Product ID:** `.../product_search/trade-policy/1?query=product:98765` or `.../product_search/trade-policy/1?query=product.id:98765`. + * - **SKU ID:** `.../product_search/trade-policy/1?query=sku.id:12345` or `.../product_search/trade-policy/1?query=sku:12345`. + * + * ## Supported ID types + * + * The possible value types for the ID segment are `product.id`, `sku.id`, `sku.ean`, `sku.reference`, `product.link`, or `id` (ProductID, ProductRefID, SKUID, SKURefID, and EAN). + * + * | ID Type | Query format | Example | + * | - | - | - | + * | Product ID | `?query=product:` or `?query=product.id:` | `?query=product:98765` | + * | SKU ID | `?query=sku:` or `?query=sku.id:` | `?query=sku.id:12345` | + * | Reference ID | `?query=sku.reference:` | `?query=sku.reference:REF123` | + * | EAN | `?query=sku.ean:` | `?query=sku.ean:7891234567890` | + * | Slug | `?query=product.link:` | `?query=product.link:blue-shirt` | */ query?: string; /** @@ -1782,12 +2072,18 @@ export type GetFacetsByFacetsData = { * Defines whether the result should hide unavailable items (`true`), or not (`false`). When set to `true`, only products with stock are returned; when set to `false`, the API includes unavailable products as well. A product is considered unavailable when `availableQuantity = 0`, while `availableQuantity = 10000` indicates that the product is available. Retailers may choose to show unavailable items for commercial reasons (for example, to signal that they offer those products even if temporarily out-of-stock). The recommended default is `true`. */ hideUnavailableItems?: boolean; + /** + * When `true`, hidden facets are omitted from the response. + */ + removeHiddenFacets?: boolean; }; url: '/facets/{facets}'; }; export type GetFacetsByFacetsResponses = { /** + * OK + * * List of facets for the given query. */ 200: Facets; @@ -1809,25 +2105,75 @@ export type GetPickupPointAvailabilityByFacetsData = { * * You can also repeat the same `facetKey` several times for different values. For example: `category-1/shoes/color/blue/color/red/color/yellow`. * + * ## Filter combinations + * + * When shoppers apply filters, the API combines them according to the following rules: + * + * - **Facets of the same type → OR (union):** When multiple values of the same facet are applied, the API returns the union of all products matching any of those values. + * - **Facets of different types → AND (intersection):** When different facet types are combined, the API returns only the products that satisfy all selected facet conditions simultaneously. + * + * ## Negative filters (NOT operator) + * + * To exclude a facet value, prefix the value with **`not:`** in the path segment: `/{facetKey}/not:{facetValue}/`. For example, `color/blue/size/not:42` keeps color blue and excludes size 42. Use the same `not:` prefix with the facet keys and values configured in your catalog. This supports use cases such as including products in one collection but excluding another. + * + * The NOT operator excludes specific values. The OR and AND rules in **Filter combinations** still describe how multiple positive facet selections combine. + * * ## Available filters * * The `facets` parameter allows the following filters: * * | `facetKey` | Description | Example | * | - | - | - | - * | `trade-policy` **(required)** | Filter the search by trade policy (also known as sales channel), following the format `trade-policy/{tradePolicyId}`. | `trade-policy/2` | - * | `price` *(optional)* | Filter the search by a price range, following the format `${minPrice}:${maxPrice}`. | `/color/blue/price/100:500?query=shirt` | - * | `category-${n}` *(optional)* | Filter the search by category, where `n` represents the category tree level (1 = department, 2 = category, 3 = subcategory, and so on). | `category-1/clothing/category-2/shirts` | - * | `productClusterIds` *(optional)* | Filter the search by collection, following the format `productClusterIds/{collectionId}`. | `productClusterIds/262` | - * + * | `trade-policy` **(required)** | Filter by trade policy (sales channel) using `trade-policy/{tradePolicyId}`. Some integrations use the `salesChannel` query string for the same purpose when supported. | `trade-policy/2` | + * | `category-${n}` *(optional)* | Filter the search by category, where n represents the category tree level (1 = department, 2 = category, 3 = subcategory, and so on). Declare the full path from the root level through every parent down to the level you need. For example, using only `category-2/shirts` without the `category-1/...` segment is incorrect. | `category-1/clothing/category-2/shirts` | + * | `brand` *(optional)* | Filter by brand slug or identifier. | `brand/acme` | + * | `{specificationName}` *(optional)* | Filter by a catalog specification exposed as a search filter, using `{specificationName}/{specificationValue}` (for example `color/blue`). | `color/blue` | + * | `productClusterIds` *(optional)* | Filter by collection ID. | `productClusterIds/262` | + * | `price` *(optional)* | Filter by price range `${minPrice}:${maxPrice}`. | `trade-policy/1/color/blue/price/100:500` (with `?query=shirt` on the full URL when using a text query). | */ facets: string | null; }; query: { /** * Search term. It can contain any character. + * + * This parameter is named `query` in the API. The short form **`q`** is an alias for `query` and has the same semantics. + * + * You can search for products or SKUs using specific ID types by adding search parameters (query) at the end of the store URL, respecting one of the following structures: + * + * - **Single item search:** `?query=[id type]:[id_1]`. Example: `?query=product:98765` + * - **Multiple items search:** `?query=[id type]:[id_1];[id_2];[id_3]`. Example: `?query=product:98765;98743` + * + * >⚠️ All searched IDs should be of the same type. + * + * ## Search by ID + * + * On the Intelligent Search API, search products or SKUs by ID by sending the value in the `query` or `q` query parameter on requests such as `/product_search/{facets}`. The `{facets}` path must include the required `trade-policy` facet and any optional filters. + * + * - **Product ID:** `.../product_search/trade-policy/1?query=product:98765` or `.../product_search/trade-policy/1?query=product.id:98765`. + * - **SKU ID:** `.../product_search/trade-policy/1?query=sku.id:12345` or `.../product_search/trade-policy/1?query=sku:12345`. + * + * ## Supported ID types + * + * The possible value types for the ID segment are `product.id`, `sku.id`, `sku.ean`, `sku.reference`, `product.link`, or `id` (ProductID, ProductRefID, SKUID, SKURefID, and EAN). + * + * | ID Type | Query format | Example | + * | - | - | - | + * | Product ID | `?query=product:` or `?query=product.id:` | `?query=product:98765` | + * | SKU ID | `?query=sku:` or `?query=sku.id:` | `?query=sku.id:12345` | + * | Reference ID | `?query=sku.reference:` | `?query=sku.reference:REF123` | + * | EAN | `?query=sku.ean:` | `?query=sku.ean:7891234567890` | + * | Slug | `?query=product.link:` | `?query=product.link:blue-shirt` | */ query?: string; + /** + * Indicates the target language as a BCP 47 language code. The Intelligent Search must have indexed the account in the target language. + */ + locale?: string | null; + /** + * Pickup point ID to filter results to a specific pickup point. + */ + pickupPoint?: string; /** * Account name. The name of the VTEX account. */ @@ -1845,13 +2191,13 @@ export type GetPickupPointAvailabilityByFacetsData = { */ country?: string; /** - * Pre-computed hash for delivery zones. Used for faster lookup. Required when using the hashes approach (alternative to country and ZIP code). + * Pre-computed hash for delivery zones. Used for faster lookup. Required when using the hashes approach (alternative to country and ZIP code). Obtain this value from the `POST` [Search delivery zones](https://developers.vtex.com/docs/api-reference/delivery-promise-suggestions-api#post-/api/logistics-shipping/delivery-zones/_search/v2) endpoint of the Delivery Promise Suggestions API. */ deliveryZonesHash?: string; /** - * Pre-computed hash for pickups. Used for faster lookup. Required when using the hashes approach (alternative to country and ZIP code). + * Pre-computed hash for pickup points. Used for faster lookup. Required when using the hashes approach (alternative to country and ZIP code). Obtain this value from the `POST` [Search pickup points](https://developers.vtex.com/docs/api-reference/delivery-promise-suggestions-api#post-/api/logistics-shipping/pickuppoints/_search) endpoint of the Delivery Promise Suggestions API. */ - pickupsHash?: string; + pickupPointsHash?: string; }; url: '/pickup-point-availability/{facets}'; }; diff --git a/vtex/server/generated/intelligent-search/zod.gen.ts b/vtex/server/generated/intelligent-search/zod.gen.ts index 72bd112c..0ec56ead 100644 --- a/vtex/server/generated/intelligent-search/zod.gen.ts +++ b/vtex/server/generated/intelligent-search/zod.gen.ts @@ -294,6 +294,16 @@ export const zProductSearch = z.object({ fuzzy: z.optional(z.string()), operator: z.optional(z.enum(['and', 'or'])), translated: z.optional(z.boolean()), + redirect: z.optional(z.union([ + z.string(), + z.null() + ])), + options: z.optional(z.object({ + sorts: z.optional(z.array(z.record(z.string(), z.unknown()))), + counts: z.optional(z.array(z.record(z.string(), z.unknown()))), + deliveryPromisesEnabled: z.optional(z.boolean()) + })), + searchId: z.optional(z.string()), pagination: z.optional(z.object({ count: z.optional(z.number()), current: z.optional(z.object({ @@ -339,7 +349,11 @@ export const zFacets = z.object({ selected: z.optional(z.boolean()), href: z.optional(z.string()) }))), - type: z.optional(z.enum(['TEXT', 'PRICERANGE'])), + type: z.optional(z.enum([ + 'TEXT', + 'PRICERANGE', + 'DELIVERY' + ])), name: z.optional(z.string()), hidden: z.optional(z.boolean()), key: z.optional(z.string()), @@ -362,6 +376,34 @@ export const zFacets = z.object({ /** * Search term. It can contain any character. + * + * This parameter is named `query` in the API. The short form **`q`** is an alias for `query` and has the same semantics. + * + * You can search for products or SKUs using specific ID types by adding search parameters (query) at the end of the store URL, respecting one of the following structures: + * + * - **Single item search:** `?query=[id type]:[id_1]`. Example: `?query=product:98765` + * - **Multiple items search:** `?query=[id type]:[id_1];[id_2];[id_3]`. Example: `?query=product:98765;98743` + * + * >⚠️ All searched IDs should be of the same type. + * + * ## Search by ID + * + * On the Intelligent Search API, search products or SKUs by ID by sending the value in the `query` or `q` query parameter on requests such as `/product_search/{facets}`. The `{facets}` path must include the required `trade-policy` facet and any optional filters. + * + * - **Product ID:** `.../product_search/trade-policy/1?query=product:98765` or `.../product_search/trade-policy/1?query=product.id:98765`. + * - **SKU ID:** `.../product_search/trade-policy/1?query=sku.id:12345` or `.../product_search/trade-policy/1?query=sku:12345`. + * + * ## Supported ID types + * + * The possible value types for the ID segment are `product.id`, `sku.id`, `sku.ean`, `sku.reference`, `product.link`, or `id` (ProductID, ProductRefID, SKUID, SKURefID, and EAN). + * + * | ID Type | Query format | Example | + * | - | - | - | + * | Product ID | `?query=product:` or `?query=product.id:` | `?query=product:98765` | + * | SKU ID | `?query=sku:` or `?query=sku.id:` | `?query=sku.id:12345` | + * | Reference ID | `?query=sku.reference:` | `?query=sku.reference:REF123` | + * | EAN | `?query=sku.ean:` | `?query=sku.ean:7891234567890` | + * | Slug | `?query=product.link:` | `?query=product.link:blue-shirt` | */ export const zQuery = z.string(); @@ -376,17 +418,31 @@ export const zQuery = z.string(); * * You can also repeat the same `facetKey` several times for different values. For example: `category-1/shoes/color/blue/color/red/color/yellow`. * + * ## Filter combinations + * + * When shoppers apply filters, the API combines them according to the following rules: + * + * - **Facets of the same type → OR (union):** When multiple values of the same facet are applied, the API returns the union of all products matching any of those values. + * - **Facets of different types → AND (intersection):** When different facet types are combined, the API returns only the products that satisfy all selected facet conditions simultaneously. + * + * ## Negative filters (NOT operator) + * + * To exclude a facet value, prefix the value with **`not:`** in the path segment: `/{facetKey}/not:{facetValue}/`. For example, `color/blue/size/not:42` keeps color blue and excludes size 42. Use the same `not:` prefix with the facet keys and values configured in your catalog. This supports use cases such as including products in one collection but excluding another. + * + * The NOT operator excludes specific values. The OR and AND rules in **Filter combinations** still describe how multiple positive facet selections combine. + * * ## Available filters * * The `facets` parameter allows the following filters: * * | `facetKey` | Description | Example | * | - | - | - | - * | `trade-policy` **(required)** | Filter the search by trade policy (also known as sales channel), following the format `trade-policy/{tradePolicyId}`. | `trade-policy/2` | - * | `price` *(optional)* | Filter the search by a price range, following the format `${minPrice}:${maxPrice}`. | `/color/blue/price/100:500?query=shirt` | - * | `category-${n}` *(optional)* | Filter the search by category, where `n` represents the category tree level (1 = department, 2 = category, 3 = subcategory, and so on). | `category-1/clothing/category-2/shirts` | - * | `productClusterIds` *(optional)* | Filter the search by collection, following the format `productClusterIds/{collectionId}`. | `productClusterIds/262` | - * + * | `trade-policy` **(required)** | Filter by trade policy (sales channel) using `trade-policy/{tradePolicyId}`. Some integrations use the `salesChannel` query string for the same purpose when supported. | `trade-policy/2` | + * | `category-${n}` *(optional)* | Filter the search by category, where n represents the category tree level (1 = department, 2 = category, 3 = subcategory, and so on). Declare the full path from the root level through every parent down to the level you need. For example, using only `category-2/shirts` without the `category-1/...` segment is incorrect. | `category-1/clothing/category-2/shirts` | + * | `brand` *(optional)* | Filter by brand slug or identifier. | `brand/acme` | + * | `{specificationName}` *(optional)* | Filter by a catalog specification exposed as a search filter, using `{specificationName}/{specificationValue}` (for example `color/blue`). | `color/blue` | + * | `productClusterIds` *(optional)* | Filter by collection ID. | `productClusterIds/262` | + * | `price` *(optional)* | Filter by price range `${minPrice}:${maxPrice}`. | `trade-policy/1/color/blue/price/100:500` (with `?query=shirt` on the full URL when using a text query). | */ export const zFacetsPath = z.union([ z.string().default('/'), @@ -394,12 +450,12 @@ export const zFacetsPath = z.union([ ]).default('/'); /** - * Amount of sponsored products to be returned. Applicable only to merchants using [VTEX Ad Network](https://help.vtex.com/en/tutorial/vtex-ad-network-beta--2cgqXcBuJmXN2livQvClur). + * Amount of sponsored products to be returned. Applicable only to merchants using [VTEX Ads](https://developers.vtex.com/docs/guides/vtex-ads). */ export const zSponsoredCount = z.string(); /** - * Advertisement placement. Applicable only to merchants using [VTEX Ad Network](https://help.vtex.com/en/tutorial/vtex-ad-network-beta--2cgqXcBuJmXN2livQvClur). + * Advertisement placement. Applicable only to merchants using [VTEX Ads](https://developers.vtex.com/docs/guides/vtex-ads). */ export const zAdvertisementPlacement = z.enum([ 'top_search', @@ -412,7 +468,7 @@ export const zAdvertisementPlacement = z.enum([ ]); /** - * Defines if sponsored products can appear again as organic listings. When set as `true`, it allows the same product to be shown as both sponsored and organic. When set as `false`, it removes duplicates, ensuring a sponsored product does not appear again as organic. Applicable only to merchants using [VTEX Ad Network](https://help.vtex.com/en/tutorial/vtex-ad-network-beta--2cgqXcBuJmXN2livQvClur). + * Defines if sponsored products can appear again as organic listings. When set as `true`, it allows the same product to be shown as both sponsored and organic. When set as `false`, it removes duplicates, ensuring a sponsored product does not appear again as organic. Applicable only to merchants using [VTEX Ads](https://developers.vtex.com/docs/guides/vtex-ads). */ export const zRepeatSponsoredProducts = z.boolean(); @@ -429,12 +485,16 @@ export const zLocale = z.union([ * * * `default` - Calls the simulation for every single seller. * * `skip` - Never calls the simulation. - * * `only1P` - Only calls the simulation for first party sellers. + * * `only1P` - Only calls the simulation for first-party sellers. + * * `only3P` - Only calls the simulation for third-party sellers. + * * `regionalize1p` - Calls regionalized simulation for first-party sellers only. */ export const zSimulationBehavior = z.enum([ 'default', 'skip', - 'only1P' + 'only1P', + 'only3P', + 'regionalize1p' ]); /** @@ -526,22 +586,6 @@ export const zGetProductSearchByFacetsData = z.object({ }), query: z.optional(z.object({ query: z.optional(z.string()), - sponsoredCount: z.optional(z.string()), - advertisementPlacement: z.optional(z.enum([ - 'top_search', - 'middle_search', - 'search_shelf', - 'cart_shelf', - 'plp_shelf', - 'autocomplete', - 'homepage' - ])), - repeatSponsoredProducts: z.optional(z.boolean()), - simulationBehavior: z.optional(z.enum([ - 'default', - 'skip', - 'only1P' - ])), count: z.optional(z.union([ z.number().default(24), z.null() @@ -550,11 +594,7 @@ export const zGetProductSearchByFacetsData = z.object({ z.number().default(1), z.null() ])).default(1), - showSponsored: z.optional(z.union([ - z.boolean().default(false), - z.null() - ])).default(false), - sort: z.optional(z.enum([ + sort: z.optional(z.nullable(z.enum([ 'price:desc', 'price:asc', 'orders:desc', @@ -562,12 +602,34 @@ export const zGetProductSearchByFacetsData = z.object({ 'name:asc', 'release:desc', 'discount:desc' - ])), + ]))), locale: z.optional(z.union([ z.string(), z.null() ])), - hideUnavailableItems: z.optional(z.boolean()).default(false) + hideUnavailableItems: z.optional(z.boolean()).default(false), + simulationBehavior: z.optional(z.enum([ + 'default', + 'skip', + 'only1P', + 'only3P', + 'regionalize1p' + ])), + showSponsored: z.optional(z.union([ + z.boolean().default(false), + z.null() + ])).default(false), + sponsoredCount: z.optional(z.string()), + advertisementPlacement: z.optional(z.enum([ + 'top_search', + 'middle_search', + 'search_shelf', + 'cart_shelf', + 'plp_shelf', + 'autocomplete', + 'homepage' + ])), + repeatSponsoredProducts: z.optional(z.boolean()) })) }); @@ -585,7 +647,8 @@ export const zGetFacetsByFacetsData = z.object({ z.string(), z.null() ])), - hideUnavailableItems: z.optional(z.boolean()).default(false) + hideUnavailableItems: z.optional(z.boolean()).default(false), + removeHiddenFacets: z.optional(z.boolean()) })) }); @@ -599,11 +662,16 @@ export const zGetPickupPointAvailabilityByFacetsData = z.object({ }), query: z.object({ query: z.optional(z.string()), + locale: z.optional(z.union([ + z.string(), + z.null() + ])), + pickupPoint: z.optional(z.string()), an: z.string(), coordinates: z.optional(z.string()), 'zip-code': z.optional(z.string()), country: z.optional(z.string()), deliveryZonesHash: z.optional(z.string()), - pickupsHash: z.optional(z.string()) + pickupPointsHash: z.optional(z.string()) }) }); diff --git a/vtex/server/generated/license-manager/index.ts b/vtex/server/generated/license-manager/index.ts index 4f60f00b..76a33b00 100644 --- a/vtex/server/generated/license-manager/index.ts +++ b/vtex/server/generated/license-manager/index.ts @@ -1,4 +1,4 @@ // This file is auto-generated by @hey-api/openapi-ts -export { createnewappkey, createUser, deleteApiLicenseManagerUsersByUserId, getAccount, getappkeysfromaccount, getByAccount, getListRoles, getListUsers, getRolesbyUser, getRolesbyUser2, getUser, type Options, putRolesinUser, removeRolefromUser, updateappkey } from './sdk.gen'; -export type { Accept, AccountResponse, AppKeyItems, ClientOptions, ContentType, CreatenewappkeyData, CreatenewappkeyRequest, CreatenewappkeyResponse, CreatenewappkeyResponse2, CreatenewappkeyResponses, CreateUserData, CreateUserError, CreateUserErrors, CreateUserRequest, CreateUserResponse, CreateUserResponses, DeleteApiLicenseManagerUsersByUserIdData, DeleteApiLicenseManagerUsersByUserIdError, DeleteApiLicenseManagerUsersByUserIdErrors, DeleteApiLicenseManagerUsersByUserIdResponses, GetAccountData, GetAccountResponse, GetAccountResponses, Getappkeysfromaccount, GetappkeysfromaccountData, GetappkeysfromaccountResponse, GetappkeysfromaccountResponses, GetByAccountData, GetByAccountResponse, GetByAccountResponses, GetListRolesData, GetListRolesResponse, GetListRolesResponses, GetListUsersData, GetListUsersResponse, GetListUsersResponses, GetRolesbyUser2Data, GetRolesbyUser2Response, GetRolesbyUser2Responses, GetRolesbyUserData, GetRolesbyUserResponse, GetRolesbyUserResponses, GetUserData, GetUserError, GetUserErrors, GetUserResponse, GetUserResponses, LicenseItems, ListRolesResponse, ListUsersResponse, Paging, ProductItems, PutRolesinUserData, PutRolesinUserError, PutRolesinUserErrors, PutRolesinUserResponse, PutRolesinUserResponses, RemoveRolefromUserData, RemoveRolefromUserError, RemoveRolefromUserErrors, RemoveRolefromUserResponse, RemoveRolefromUserResponses, RoleItems, SiteItems, StoreItems, UpdateappkeyData, UpdateappkeyError, UpdateappkeyErrors, UpdateappkeyRequest, UpdateappkeyResponses, UserItems, VlmError } from './types.gen'; +export { createnewappkey, createUser, deleteApiLicenseManagerUsersByUserId, getAccount, getappkeysfromaccount, getByAccount, getListRoles, getListUsers, getRolesbyUser, getUser, type Options, putRolesinUser, removeRolefromUser, updateappkey } from './sdk.gen'; +export type { Accept, AccountResponse, AppKeyItems, ClientOptions, ContentType, CreatenewappkeyData, CreatenewappkeyRequest, CreatenewappkeyResponse, CreatenewappkeyResponse2, CreatenewappkeyResponses, CreateUserData, CreateUserError, CreateUserErrors, CreateUserRequest, CreateUserResponse, CreateUserResponses, DeleteApiLicenseManagerUsersByUserIdData, DeleteApiLicenseManagerUsersByUserIdError, DeleteApiLicenseManagerUsersByUserIdErrors, DeleteApiLicenseManagerUsersByUserIdResponses, GetAccountData, GetAccountResponse, GetAccountResponses, Getappkeysfromaccount, GetappkeysfromaccountData, GetappkeysfromaccountResponse, GetappkeysfromaccountResponses, GetByAccountData, GetByAccountResponse, GetByAccountResponses, GetListRolesData, GetListRolesResponse, GetListRolesResponses, GetListUsersData, GetListUsersResponse, GetListUsersResponses, GetRolesbyUserData, GetRolesbyUserResponse, GetRolesbyUserResponses, GetUserData, GetUserError, GetUserErrors, GetUserResponse, GetUserResponses, LicenseItems, ListRolesResponse, ListUsersResponse, Paging, ProductItems, PutRolesinUserData, PutRolesinUserError, PutRolesinUserErrors, PutRolesinUserResponse, PutRolesinUserResponses, RemoveRolefromUserData, RemoveRolefromUserError, RemoveRolefromUserErrors, RemoveRolefromUserResponse, RemoveRolefromUserResponses, RoleItems, SiteItems, StoreItems, UpdateappkeyData, UpdateappkeyError, UpdateappkeyErrors, UpdateappkeyRequest, UpdateappkeyResponses, UserItems, VlmError } from './types.gen'; diff --git a/vtex/server/generated/license-manager/sdk.gen.ts b/vtex/server/generated/license-manager/sdk.gen.ts index 6f0fb6f1..8d76281e 100644 --- a/vtex/server/generated/license-manager/sdk.gen.ts +++ b/vtex/server/generated/license-manager/sdk.gen.ts @@ -2,7 +2,7 @@ import type { Client, Options as Options2, TDataShape } from './client'; import { client } from './client.gen'; -import type { CreatenewappkeyData, CreatenewappkeyResponses, CreateUserData, CreateUserErrors, CreateUserResponses, DeleteApiLicenseManagerUsersByUserIdData, DeleteApiLicenseManagerUsersByUserIdErrors, DeleteApiLicenseManagerUsersByUserIdResponses, GetAccountData, GetAccountResponses, GetappkeysfromaccountData, GetappkeysfromaccountResponses, GetByAccountData, GetByAccountResponses, GetListRolesData, GetListRolesResponses, GetListUsersData, GetListUsersResponses, GetRolesbyUser2Data, GetRolesbyUser2Responses, GetRolesbyUserData, GetRolesbyUserResponses, GetUserData, GetUserErrors, GetUserResponses, PutRolesinUserData, PutRolesinUserErrors, PutRolesinUserResponses, RemoveRolefromUserData, RemoveRolefromUserErrors, RemoveRolefromUserResponses, UpdateappkeyData, UpdateappkeyErrors, UpdateappkeyResponses } from './types.gen'; +import type { CreatenewappkeyData, CreatenewappkeyResponses, CreateUserData, CreateUserErrors, CreateUserResponses, DeleteApiLicenseManagerUsersByUserIdData, DeleteApiLicenseManagerUsersByUserIdErrors, DeleteApiLicenseManagerUsersByUserIdResponses, GetAccountData, GetAccountResponses, GetappkeysfromaccountData, GetappkeysfromaccountResponses, GetByAccountData, GetByAccountResponses, GetListRolesData, GetListRolesResponses, GetListUsersData, GetListUsersResponses, GetRolesbyUserData, GetRolesbyUserResponses, GetUserData, GetUserErrors, GetUserResponses, PutRolesinUserData, PutRolesinUserErrors, PutRolesinUserResponses, RemoveRolefromUserData, RemoveRolefromUserErrors, RemoveRolefromUserResponses, UpdateappkeyData, UpdateappkeyErrors, UpdateappkeyResponses } from './types.gen'; export type Options = Options2 & { /** @@ -19,9 +19,9 @@ export type Options(options: Options(options: Option }); /** - * Get list of users + * Get list of admin users * - * Returns a list of registered users. The response is divided in pages. The query parameter `numItems` defines the number of items in each page, and consequently the amount of pages for the whole list. + * Returns a list of registered admin users. The response is divided in pages. The query parameter `numItems` defines the number of items in each page, and consequently the amount of pages for the whole list. * * ## Permissions * @@ -152,9 +152,9 @@ export const getListUsers = (options: Opti }); /** - * Get roles by user ID or API Key + * Get roles by admin user ID or API Key * - * Retrieves License Manager [roles](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc) of a particular user or API key. + * Retrieves License Manager [roles](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc) of a particular admin user or API key. * * ## Permissions * @@ -179,9 +179,9 @@ export const getRolesbyUser = (options: Op }); /** - * Add roles to user or API Key + * Add roles to admin user or API Key * - * Allows you to add License Manager [roles](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc) to a particular user or API key by specifying the list of role IDs on the request body. + * Allows you to add License Manager [roles](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc) to a particular admin user or API key by specifying the list of role IDs on the request body. * * ## Permissions * @@ -216,36 +216,9 @@ export const putRolesinUser = (options: Op }); /** - * Get user information by user email + * Remove role from admin user or API Key * - * Retrieves user ID and License Manager [roles](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc) of a particular user. - * - * ## Permissions - * - * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: - * - * | **Product** | **Category** | **Resource** | - * | --------------- | ----------------- | ----------------- | - * | License Manager | Services access control | **View_Storefront_User_Permissions** | - * - * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication). - * - * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing app keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. - */ -export const getRolesbyUser2 = (options: Options) => (options.client ?? client).get({ - security: [ - { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, - { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, - { name: 'VtexIdclientAutCookie', type: 'apiKey' } - ], - url: '/api/license-manager/users/{userEmail}/roles', - ...options -}); - -/** - * Remove role from user or API Key - * - * Allows you to remove a License Manager [role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc) from a specific user or API key. This method only allows the removal of one role per request. The role's ID must be specified on the request path, not on the request body. + * Allows you to remove a License Manager [role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc) from a specific admin user or API key. This method only allows the removal of one role per request. The role's ID must be specified on the request path, not on the request body. * * * > Note that a successful response returns a `204` response with an empty body. A deletion on a role or user that does not exist will also return a `204`. Thus, this method should not be used to verify the existence of a specific user or role. diff --git a/vtex/server/generated/license-manager/types.gen.ts b/vtex/server/generated/license-manager/types.gen.ts index 07fc4319..9956d096 100644 --- a/vtex/server/generated/license-manager/types.gen.ts +++ b/vtex/server/generated/license-manager/types.gen.ts @@ -943,52 +943,6 @@ export type PutRolesinUserResponses = { export type PutRolesinUserResponse = PutRolesinUserResponses[keyof PutRolesinUserResponses]; -export type GetRolesbyUser2Data = { - body?: never; - headers: { - /** - * Type of the content being sent. - */ - 'Content-Type': string; - /** - * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. - */ - Accept: string; - }; - path: { - /** - * Email of the user. - */ - userEmail: string; - }; - query?: never; - url: '/api/license-manager/users/{userEmail}/roles'; -}; - -export type GetRolesbyUser2Responses = { - 200: { - /** - * ID of the user. - */ - UserId?: string; - /** - * Email of the user. - */ - Email?: string; - /** - * Array of role objects. - */ - Roles?: Array<{ - /** - * Name of the role. - */ - name?: string; - }>; - }; -}; - -export type GetRolesbyUser2Response = GetRolesbyUser2Responses[keyof GetRolesbyUser2Responses]; - export type RemoveRolefromUserData = { body?: never; headers: { diff --git a/vtex/server/generated/license-manager/zod.gen.ts b/vtex/server/generated/license-manager/zod.gen.ts index 4c18a2b0..096ffb5e 100644 --- a/vtex/server/generated/license-manager/zod.gen.ts +++ b/vtex/server/generated/license-manager/zod.gen.ts @@ -422,18 +422,6 @@ export const zPutRolesinUserData = z.object({ query: z.optional(z.never()) }); -export const zGetRolesbyUser2Data = z.object({ - body: z.optional(z.never()), - path: z.object({ - userEmail: z.string() - }), - query: z.optional(z.never()), - headers: z.object({ - 'Content-Type': z.string().default('application/json'), - Accept: z.string().default('application/json') - }) -}); - export const zRemoveRolefromUserData = z.object({ body: z.optional(z.never()), path: z.object({ diff --git a/vtex/server/generated/logistics/index.ts b/vtex/server/generated/logistics/index.ts index 85fc09f0..fff93d0a 100644 --- a/vtex/server/generated/logistics/index.ts +++ b/vtex/server/generated/logistics/index.ts @@ -1,4 +1,4 @@ // This file is auto-generated by @hey-api/openapi-ts -export { acknowledgmentReservation, activateDock, activateWarehouse, addBlockedDeliveryWindows, allDocks, allHolidays, allWarehouses, calculateSla, cancelReservation, confirmReservation, createReservation, createUpdateDock, createUpdateFreightValues, createUpdateHoliday, createUpdatePickupPoint, createUpdatePolygon, createUpdateWarehouse, deactivateDock, deactivateWarehouse, delete_, deleteApiLogisticsPvtShippingPoliciesById, deletePolygon, dock, dockById, freightValues, getApiLogisticsCapacityResourcesCarrier_byCapacityType_byShippingPolicyIdTimeFrames, getApiLogisticsCapacityResourcesCarrier_byCapacityType_byShippingPolicyIdTimeFramesByWindowDayFbyWindowStartTimeTbyWindowEndTime, getApiLogisticsPvtShippingPolicies, getApiLogisticsPvtShippingPoliciesById, getById, getinventorywithdispatchedreservations, getpaged, getSupplyLots, holiday, holidayById, inventoryBySku, inventoryperdock, inventoryperdockandwarehouse, inventoryperwarehouse, listAllPickupPpoints, type Options, pagedPolygons, patchApiLogisticsPvtInventorySkusBySkuIdWarehousesByWarehouseIdLeadTime, patchApiLogisticsPvtInventorySkusBySkuIdWarehousesByWarehouseIdQuantity, polygonbyId, postApiLogisticsPvtShippingPolicies, putApiLogisticsPvtShippingPoliciesById, removeBlockedDeliveryWindows, removeWarehouse, reservationById, reservationbyWarehouseandSku, retrieveBlockedDeliveryWindows, saveSupplyLot, transferSupplyLot, updateInventoryBySkuandWarehouse, warehouseById } from './sdk.gen'; -export type { Accept, AcknowledgmentReservationData, AcknowledgmentReservationResponses, ActivateDockData, ActivateDockResponse, ActivateDockResponses, ActivateWarehouseData, ActivateWarehouseResponses, AddBlockedDeliveryWindowsData, AddBlockedDeliveryWindowsResponse, AddBlockedDeliveryWindowsResponses, AllDocksData, AllDocksResponse, AllDocksResponses, AllHolidaysData, AllHolidaysResponses, AllWarehousesData, AllWarehousesResponse, AllWarehousesResponses, CalculateSlaData, CalculateSlaResponse, CalculateSlaResponses, CancelReservationData, CancelReservationResponses, ClientOptions, ConfirmReservationData, ConfirmReservationResponses, ContentType, CreateReservationData, CreateReservationResponse, CreateReservationResponses, CreateUpdateDockData, CreateUpdateDockResponse, CreateUpdateDockResponses, CreateUpdateFreightValuesData, CreateUpdateFreightValuesResponses, CreateUpdateHolidayData, CreateUpdateHolidayResponses, CreateUpdatePickupPointData, CreateUpdatePickupPointResponse, CreateUpdatePickupPointResponses, CreateUpdatePolygonData, CreateUpdatePolygonErrors, CreateUpdatePolygonResponse, CreateUpdatePolygonResponses, CreateUpdateWarehouseData, CreateUpdateWarehouseResponses, DeactivateDockData, DeactivateDockResponse, DeactivateDockResponses, DeactivateWarehouseData, DeactivateWarehouseResponses, DeleteApiLogisticsPvtShippingPoliciesByIdData, DeleteApiLogisticsPvtShippingPoliciesByIdResponses, DeleteData, DeletePolygonData, DeletePolygonResponse, DeletePolygonResponses, DeleteResponse, DeleteResponses, DeliveryCapacity, DockByIdData, DockByIdResponse, DockByIdResponses, DockData, DockResponse, DockResponses, FreightValuesData, FreightValuesResponse, FreightValuesResponses, GetApiLogisticsCapacityResourcesCarrier_byCapacityType_byShippingPolicyIdTimeFramesByWindowDayFbyWindowStartTimeTbyWindowEndTimeData, GetApiLogisticsCapacityResourcesCarrier_byCapacityType_byShippingPolicyIdTimeFramesByWindowDayFbyWindowStartTimeTbyWindowEndTimeResponse, GetApiLogisticsCapacityResourcesCarrier_byCapacityType_byShippingPolicyIdTimeFramesByWindowDayFbyWindowStartTimeTbyWindowEndTimeResponses, GetApiLogisticsCapacityResourcesCarrier_byCapacityType_byShippingPolicyIdTimeFramesData, GetApiLogisticsCapacityResourcesCarrier_byCapacityType_byShippingPolicyIdTimeFramesResponse, GetApiLogisticsCapacityResourcesCarrier_byCapacityType_byShippingPolicyIdTimeFramesResponses, GetApiLogisticsPvtShippingPoliciesByIdData, GetApiLogisticsPvtShippingPoliciesByIdResponse, GetApiLogisticsPvtShippingPoliciesByIdResponses, GetApiLogisticsPvtShippingPoliciesData, GetApiLogisticsPvtShippingPoliciesResponse, GetApiLogisticsPvtShippingPoliciesResponses, GetByIdData, GetByIdResponse, GetByIdResponses, GetinventorywithdispatchedreservationsData, GetinventorywithdispatchedreservationsResponse, GetinventorywithdispatchedreservationsResponses, GetpagedData, GetpagedResponse, GetpagedResponses, GetSupplyLotsData, GetSupplyLotsResponse, GetSupplyLotsResponses, HolidayByIdData, HolidayByIdResponses, HolidayData, HolidayResponses, InventoryBySkuData, InventoryBySkuResponse, InventoryBySkuResponses, InventoryperdockandwarehouseData, InventoryperdockandwarehouseResponse, InventoryperdockandwarehouseResponses, InventoryperdockData, InventoryperdockResponse, InventoryperdockResponses, InventoryperwarehouseData, InventoryperwarehouseResponse, InventoryperwarehouseResponses, ListAllPickupPpointsData, ListAllPickupPpointsResponse, ListAllPickupPpointsResponses, ListDocksById, PagedPolygonsData, PagedPolygonsResponse, PagedPolygonsResponses, PatchApiLogisticsPvtInventorySkusBySkuIdWarehousesByWarehouseIdLeadTimeData, PatchApiLogisticsPvtInventorySkusBySkuIdWarehousesByWarehouseIdLeadTimeErrors, PatchApiLogisticsPvtInventorySkusBySkuIdWarehousesByWarehouseIdLeadTimeResponse, PatchApiLogisticsPvtInventorySkusBySkuIdWarehousesByWarehouseIdLeadTimeResponses, PatchApiLogisticsPvtInventorySkusBySkuIdWarehousesByWarehouseIdQuantityData, PatchApiLogisticsPvtInventorySkusBySkuIdWarehousesByWarehouseIdQuantityErrors, PatchApiLogisticsPvtInventorySkusBySkuIdWarehousesByWarehouseIdQuantityResponse, PatchApiLogisticsPvtInventorySkusBySkuIdWarehousesByWarehouseIdQuantityResponses, PickupPoint, PolygonbyIdData, PolygonbyIdResponse, PolygonbyIdResponses, PostApiLogisticsPvtShippingPoliciesData, PostApiLogisticsPvtShippingPoliciesResponses, PutApiLogisticsPvtShippingPoliciesByIdData, PutApiLogisticsPvtShippingPoliciesByIdResponses, RemoveBlockedDeliveryWindowsData, RemoveBlockedDeliveryWindowsResponse, RemoveBlockedDeliveryWindowsResponses, RemoveWarehouseData, RemoveWarehouseResponses, ReservationByIdData, ReservationByIdResponse, ReservationByIdResponses, ReservationbyWarehouseandSkuData, ReservationbyWarehouseandSkuResponses, RetrieveBlockedDeliveryWindowsData, RetrieveBlockedDeliveryWindowsResponse, RetrieveBlockedDeliveryWindowsResponses, SaveSupplyLotData, SaveSupplyLotResponse, SaveSupplyLotResponses, ShippingPolicy, TransferSupplyLotData, TransferSupplyLotResponse, TransferSupplyLotResponses, UpdateInventoryBySkuandWarehouseData, UpdateInventoryBySkuandWarehouseError, UpdateInventoryBySkuandWarehouseErrors, UpdateInventoryBySkuandWarehouseResponses, WarehouseByIdData, WarehouseByIdResponse, WarehouseByIdResponses } from './types.gen'; +export { acknowledgmentReservation, activateDock, activateWarehouse, addBlockedDeliveryWindows, allDocks, allHolidays, allWarehouses, calculateSla, cancelReservation, confirmReservation, createReservation, createUpdateDock, createUpdateFreightValues, createUpdateHoliday, createUpdatePickupPoint, createUpdatePolygon, createUpdateWarehouse, deactivateDock, deactivateWarehouse, delete_, deleteApiLogisticsPvtShippingPoliciesById, deletePolygon, dock, dockById, freightValues, getApiLogisticsCapacityResourcesCarrier_byCapacityType_byShippingPolicyIdTimeFrames, getApiLogisticsCapacityResourcesCarrier_byCapacityType_byShippingPolicyIdTimeFramesByWindowDayFbyWindowStartTimeTbyWindowEndTime, getApiLogisticsPvtShippingPolicies, getApiLogisticsPvtShippingPoliciesById, getAvailabilityV1InventoryBatchByBatchIdErrors, getAvailabilityV1InventoryBatchByBatchIdStatus, getById, getinventorywithdispatchedreservations, getpaged, getSupplyLots, holiday, holidayById, inventoryBySku, inventoryperdock, inventoryperdockandwarehouse, inventoryperwarehouse, listAllPickupPpoints, type Options, pagedPolygons, patchApiLogisticsPvtInventorySkusBySkuIdWarehousesByWarehouseIdLeadTime, patchApiLogisticsPvtInventorySkusBySkuIdWarehousesByWarehouseIdQuantity, polygonbyId, postApiLogisticsPvtShippingPolicies, postAvailabilityV1InventoryBatch, postAvailabilityV1InventoryBatchByBatchIdConfirm, putApiLogisticsPvtShippingPoliciesById, removeBlockedDeliveryWindows, removeWarehouse, reservationById, reservationbyWarehouseandSku, retrieveBlockedDeliveryWindows, saveSupplyLot, transferSupplyLot, updateInventoryBySkuandWarehouse, warehouseById } from './sdk.gen'; +export type { Accept, AcknowledgmentReservationData, AcknowledgmentReservationResponses, ActivateDockData, ActivateDockResponse, ActivateDockResponses, ActivateWarehouseData, ActivateWarehouseResponses, AddBlockedDeliveryWindowsData, AddBlockedDeliveryWindowsResponse, AddBlockedDeliveryWindowsResponses, AllDocksData, AllDocksResponse, AllDocksResponses, AllHolidaysData, AllHolidaysResponses, AllWarehousesData, AllWarehousesResponse, AllWarehousesResponses, BatchId, CalculateSlaData, CalculateSlaResponse, CalculateSlaResponses, CancelReservationData, CancelReservationResponses, ClientOptions, ConfirmReservationData, ConfirmReservationResponses, ContentType, CreateReservationData, CreateReservationResponse, CreateReservationResponses, CreateUpdateDockData, CreateUpdateDockResponse, CreateUpdateDockResponses, CreateUpdateFreightValuesData, CreateUpdateFreightValuesResponses, CreateUpdateHolidayData, CreateUpdateHolidayResponses, CreateUpdatePickupPointData, CreateUpdatePickupPointResponse, CreateUpdatePickupPointResponses, CreateUpdatePolygonData, CreateUpdatePolygonErrors, CreateUpdatePolygonResponse, CreateUpdatePolygonResponses, CreateUpdateWarehouseData, CreateUpdateWarehouseResponses, DeactivateDockData, DeactivateDockResponse, DeactivateDockResponses, DeactivateWarehouseData, DeactivateWarehouseResponses, DeleteApiLogisticsPvtShippingPoliciesByIdData, DeleteApiLogisticsPvtShippingPoliciesByIdResponses, DeleteData, DeletePolygonData, DeletePolygonResponse, DeletePolygonResponses, DeleteResponse, DeleteResponses, DeliveryCapacity, DockByIdData, DockByIdResponse, DockByIdResponses, DockData, DockResponse, DockResponses, FreightValuesData, FreightValuesResponse, FreightValuesResponses, GetApiLogisticsCapacityResourcesCarrier_byCapacityType_byShippingPolicyIdTimeFramesByWindowDayFbyWindowStartTimeTbyWindowEndTimeData, GetApiLogisticsCapacityResourcesCarrier_byCapacityType_byShippingPolicyIdTimeFramesByWindowDayFbyWindowStartTimeTbyWindowEndTimeResponse, GetApiLogisticsCapacityResourcesCarrier_byCapacityType_byShippingPolicyIdTimeFramesByWindowDayFbyWindowStartTimeTbyWindowEndTimeResponses, GetApiLogisticsCapacityResourcesCarrier_byCapacityType_byShippingPolicyIdTimeFramesData, GetApiLogisticsCapacityResourcesCarrier_byCapacityType_byShippingPolicyIdTimeFramesResponse, GetApiLogisticsCapacityResourcesCarrier_byCapacityType_byShippingPolicyIdTimeFramesResponses, GetApiLogisticsPvtShippingPoliciesByIdData, GetApiLogisticsPvtShippingPoliciesByIdResponse, GetApiLogisticsPvtShippingPoliciesByIdResponses, GetApiLogisticsPvtShippingPoliciesData, GetApiLogisticsPvtShippingPoliciesResponse, GetApiLogisticsPvtShippingPoliciesResponses, GetAvailabilityV1InventoryBatchByBatchIdErrorsData, GetAvailabilityV1InventoryBatchByBatchIdErrorsErrors, GetAvailabilityV1InventoryBatchByBatchIdErrorsResponse, GetAvailabilityV1InventoryBatchByBatchIdErrorsResponses, GetAvailabilityV1InventoryBatchByBatchIdStatusData, GetAvailabilityV1InventoryBatchByBatchIdStatusErrors, GetAvailabilityV1InventoryBatchByBatchIdStatusResponse, GetAvailabilityV1InventoryBatchByBatchIdStatusResponses, GetByIdData, GetByIdResponse, GetByIdResponses, GetinventorywithdispatchedreservationsData, GetinventorywithdispatchedreservationsResponse, GetinventorywithdispatchedreservationsResponses, GetpagedData, GetpagedResponse, GetpagedResponses, GetSupplyLotsData, GetSupplyLotsResponse, GetSupplyLotsResponses, HolidayByIdData, HolidayByIdResponses, HolidayData, HolidayResponses, InventoryBySkuData, InventoryBySkuResponse, InventoryBySkuResponses, InventoryperdockandwarehouseData, InventoryperdockandwarehouseResponse, InventoryperdockandwarehouseResponses, InventoryperdockData, InventoryperdockResponse, InventoryperdockResponses, InventoryperwarehouseData, InventoryperwarehouseResponse, InventoryperwarehouseResponses, ListAllPickupPpointsData, ListAllPickupPpointsResponse, ListAllPickupPpointsResponses, ListDocksById, PagedPolygonsData, PagedPolygonsResponse, PagedPolygonsResponses, PatchApiLogisticsPvtInventorySkusBySkuIdWarehousesByWarehouseIdLeadTimeData, PatchApiLogisticsPvtInventorySkusBySkuIdWarehousesByWarehouseIdLeadTimeErrors, PatchApiLogisticsPvtInventorySkusBySkuIdWarehousesByWarehouseIdLeadTimeResponse, PatchApiLogisticsPvtInventorySkusBySkuIdWarehousesByWarehouseIdLeadTimeResponses, PatchApiLogisticsPvtInventorySkusBySkuIdWarehousesByWarehouseIdQuantityData, PatchApiLogisticsPvtInventorySkusBySkuIdWarehousesByWarehouseIdQuantityErrors, PatchApiLogisticsPvtInventorySkusBySkuIdWarehousesByWarehouseIdQuantityResponse, PatchApiLogisticsPvtInventorySkusBySkuIdWarehousesByWarehouseIdQuantityResponses, PickupPoint, PolygonbyIdData, PolygonbyIdResponse, PolygonbyIdResponses, PostApiLogisticsPvtShippingPoliciesData, PostApiLogisticsPvtShippingPoliciesResponses, PostAvailabilityV1InventoryBatchByBatchIdConfirmData, PostAvailabilityV1InventoryBatchByBatchIdConfirmErrors, PostAvailabilityV1InventoryBatchByBatchIdConfirmResponses, PostAvailabilityV1InventoryBatchData, PostAvailabilityV1InventoryBatchErrors, PostAvailabilityV1InventoryBatchResponse, PostAvailabilityV1InventoryBatchResponses, PutApiLogisticsPvtShippingPoliciesByIdData, PutApiLogisticsPvtShippingPoliciesByIdResponses, RemoveBlockedDeliveryWindowsData, RemoveBlockedDeliveryWindowsResponse, RemoveBlockedDeliveryWindowsResponses, RemoveWarehouseData, RemoveWarehouseResponses, ReservationByIdData, ReservationByIdResponse, ReservationByIdResponses, ReservationbyWarehouseandSkuData, ReservationbyWarehouseandSkuResponses, RetrieveBlockedDeliveryWindowsData, RetrieveBlockedDeliveryWindowsResponse, RetrieveBlockedDeliveryWindowsResponses, SaveSupplyLotData, SaveSupplyLotResponse, SaveSupplyLotResponses, ShippingPolicy, TransferSupplyLotData, TransferSupplyLotResponse, TransferSupplyLotResponses, UpdateInventoryBySkuandWarehouseData, UpdateInventoryBySkuandWarehouseError, UpdateInventoryBySkuandWarehouseErrors, UpdateInventoryBySkuandWarehouseResponses, WarehouseByIdData, WarehouseByIdResponse, WarehouseByIdResponses } from './types.gen'; diff --git a/vtex/server/generated/logistics/sdk.gen.ts b/vtex/server/generated/logistics/sdk.gen.ts index 97feb061..0314da31 100644 --- a/vtex/server/generated/logistics/sdk.gen.ts +++ b/vtex/server/generated/logistics/sdk.gen.ts @@ -2,7 +2,7 @@ import type { Client, Options as Options2, TDataShape } from './client'; import { client } from './client.gen'; -import type { AcknowledgmentReservationData, AcknowledgmentReservationResponses, ActivateDockData, ActivateDockResponses, ActivateWarehouseData, ActivateWarehouseResponses, AddBlockedDeliveryWindowsData, AddBlockedDeliveryWindowsResponses, AllDocksData, AllDocksResponses, AllHolidaysData, AllHolidaysResponses, AllWarehousesData, AllWarehousesResponses, CalculateSlaData, CalculateSlaResponses, CancelReservationData, CancelReservationResponses, ConfirmReservationData, ConfirmReservationResponses, CreateReservationData, CreateReservationResponses, CreateUpdateDockData, CreateUpdateDockResponses, CreateUpdateFreightValuesData, CreateUpdateFreightValuesResponses, CreateUpdateHolidayData, CreateUpdateHolidayResponses, CreateUpdatePickupPointData, CreateUpdatePickupPointResponses, CreateUpdatePolygonData, CreateUpdatePolygonErrors, CreateUpdatePolygonResponses, CreateUpdateWarehouseData, CreateUpdateWarehouseResponses, DeactivateDockData, DeactivateDockResponses, DeactivateWarehouseData, DeactivateWarehouseResponses, DeleteApiLogisticsPvtShippingPoliciesByIdData, DeleteApiLogisticsPvtShippingPoliciesByIdResponses, DeleteData, DeletePolygonData, DeletePolygonResponses, DeleteResponses, DockByIdData, DockByIdResponses, DockData, DockResponses, FreightValuesData, FreightValuesResponses, GetApiLogisticsCapacityResourcesCarrier_byCapacityType_byShippingPolicyIdTimeFramesByWindowDayFbyWindowStartTimeTbyWindowEndTimeData, GetApiLogisticsCapacityResourcesCarrier_byCapacityType_byShippingPolicyIdTimeFramesByWindowDayFbyWindowStartTimeTbyWindowEndTimeResponses, GetApiLogisticsCapacityResourcesCarrier_byCapacityType_byShippingPolicyIdTimeFramesData, GetApiLogisticsCapacityResourcesCarrier_byCapacityType_byShippingPolicyIdTimeFramesResponses, GetApiLogisticsPvtShippingPoliciesByIdData, GetApiLogisticsPvtShippingPoliciesByIdResponses, GetApiLogisticsPvtShippingPoliciesData, GetApiLogisticsPvtShippingPoliciesResponses, GetByIdData, GetByIdResponses, GetinventorywithdispatchedreservationsData, GetinventorywithdispatchedreservationsResponses, GetpagedData, GetpagedResponses, GetSupplyLotsData, GetSupplyLotsResponses, HolidayByIdData, HolidayByIdResponses, HolidayData, HolidayResponses, InventoryBySkuData, InventoryBySkuResponses, InventoryperdockandwarehouseData, InventoryperdockandwarehouseResponses, InventoryperdockData, InventoryperdockResponses, InventoryperwarehouseData, InventoryperwarehouseResponses, ListAllPickupPpointsData, ListAllPickupPpointsResponses, PagedPolygonsData, PagedPolygonsResponses, PatchApiLogisticsPvtInventorySkusBySkuIdWarehousesByWarehouseIdLeadTimeData, PatchApiLogisticsPvtInventorySkusBySkuIdWarehousesByWarehouseIdLeadTimeErrors, PatchApiLogisticsPvtInventorySkusBySkuIdWarehousesByWarehouseIdLeadTimeResponses, PatchApiLogisticsPvtInventorySkusBySkuIdWarehousesByWarehouseIdQuantityData, PatchApiLogisticsPvtInventorySkusBySkuIdWarehousesByWarehouseIdQuantityErrors, PatchApiLogisticsPvtInventorySkusBySkuIdWarehousesByWarehouseIdQuantityResponses, PolygonbyIdData, PolygonbyIdResponses, PostApiLogisticsPvtShippingPoliciesData, PostApiLogisticsPvtShippingPoliciesResponses, PutApiLogisticsPvtShippingPoliciesByIdData, PutApiLogisticsPvtShippingPoliciesByIdResponses, RemoveBlockedDeliveryWindowsData, RemoveBlockedDeliveryWindowsResponses, RemoveWarehouseData, RemoveWarehouseResponses, ReservationByIdData, ReservationByIdResponses, ReservationbyWarehouseandSkuData, ReservationbyWarehouseandSkuResponses, RetrieveBlockedDeliveryWindowsData, RetrieveBlockedDeliveryWindowsResponses, SaveSupplyLotData, SaveSupplyLotResponses, TransferSupplyLotData, TransferSupplyLotResponses, UpdateInventoryBySkuandWarehouseData, UpdateInventoryBySkuandWarehouseErrors, UpdateInventoryBySkuandWarehouseResponses, WarehouseByIdData, WarehouseByIdResponses } from './types.gen'; +import type { AcknowledgmentReservationData, AcknowledgmentReservationResponses, ActivateDockData, ActivateDockResponses, ActivateWarehouseData, ActivateWarehouseResponses, AddBlockedDeliveryWindowsData, AddBlockedDeliveryWindowsResponses, AllDocksData, AllDocksResponses, AllHolidaysData, AllHolidaysResponses, AllWarehousesData, AllWarehousesResponses, CalculateSlaData, CalculateSlaResponses, CancelReservationData, CancelReservationResponses, ConfirmReservationData, ConfirmReservationResponses, CreateReservationData, CreateReservationResponses, CreateUpdateDockData, CreateUpdateDockResponses, CreateUpdateFreightValuesData, CreateUpdateFreightValuesResponses, CreateUpdateHolidayData, CreateUpdateHolidayResponses, CreateUpdatePickupPointData, CreateUpdatePickupPointResponses, CreateUpdatePolygonData, CreateUpdatePolygonErrors, CreateUpdatePolygonResponses, CreateUpdateWarehouseData, CreateUpdateWarehouseResponses, DeactivateDockData, DeactivateDockResponses, DeactivateWarehouseData, DeactivateWarehouseResponses, DeleteApiLogisticsPvtShippingPoliciesByIdData, DeleteApiLogisticsPvtShippingPoliciesByIdResponses, DeleteData, DeletePolygonData, DeletePolygonResponses, DeleteResponses, DockByIdData, DockByIdResponses, DockData, DockResponses, FreightValuesData, FreightValuesResponses, GetApiLogisticsCapacityResourcesCarrier_byCapacityType_byShippingPolicyIdTimeFramesByWindowDayFbyWindowStartTimeTbyWindowEndTimeData, GetApiLogisticsCapacityResourcesCarrier_byCapacityType_byShippingPolicyIdTimeFramesByWindowDayFbyWindowStartTimeTbyWindowEndTimeResponses, GetApiLogisticsCapacityResourcesCarrier_byCapacityType_byShippingPolicyIdTimeFramesData, GetApiLogisticsCapacityResourcesCarrier_byCapacityType_byShippingPolicyIdTimeFramesResponses, GetApiLogisticsPvtShippingPoliciesByIdData, GetApiLogisticsPvtShippingPoliciesByIdResponses, GetApiLogisticsPvtShippingPoliciesData, GetApiLogisticsPvtShippingPoliciesResponses, GetAvailabilityV1InventoryBatchByBatchIdErrorsData, GetAvailabilityV1InventoryBatchByBatchIdErrorsErrors, GetAvailabilityV1InventoryBatchByBatchIdErrorsResponses, GetAvailabilityV1InventoryBatchByBatchIdStatusData, GetAvailabilityV1InventoryBatchByBatchIdStatusErrors, GetAvailabilityV1InventoryBatchByBatchIdStatusResponses, GetByIdData, GetByIdResponses, GetinventorywithdispatchedreservationsData, GetinventorywithdispatchedreservationsResponses, GetpagedData, GetpagedResponses, GetSupplyLotsData, GetSupplyLotsResponses, HolidayByIdData, HolidayByIdResponses, HolidayData, HolidayResponses, InventoryBySkuData, InventoryBySkuResponses, InventoryperdockandwarehouseData, InventoryperdockandwarehouseResponses, InventoryperdockData, InventoryperdockResponses, InventoryperwarehouseData, InventoryperwarehouseResponses, ListAllPickupPpointsData, ListAllPickupPpointsResponses, PagedPolygonsData, PagedPolygonsResponses, PatchApiLogisticsPvtInventorySkusBySkuIdWarehousesByWarehouseIdLeadTimeData, PatchApiLogisticsPvtInventorySkusBySkuIdWarehousesByWarehouseIdLeadTimeErrors, PatchApiLogisticsPvtInventorySkusBySkuIdWarehousesByWarehouseIdLeadTimeResponses, PatchApiLogisticsPvtInventorySkusBySkuIdWarehousesByWarehouseIdQuantityData, PatchApiLogisticsPvtInventorySkusBySkuIdWarehousesByWarehouseIdQuantityErrors, PatchApiLogisticsPvtInventorySkusBySkuIdWarehousesByWarehouseIdQuantityResponses, PolygonbyIdData, PolygonbyIdResponses, PostApiLogisticsPvtShippingPoliciesData, PostApiLogisticsPvtShippingPoliciesResponses, PostAvailabilityV1InventoryBatchByBatchIdConfirmData, PostAvailabilityV1InventoryBatchByBatchIdConfirmErrors, PostAvailabilityV1InventoryBatchByBatchIdConfirmResponses, PostAvailabilityV1InventoryBatchData, PostAvailabilityV1InventoryBatchErrors, PostAvailabilityV1InventoryBatchResponses, PutApiLogisticsPvtShippingPoliciesByIdData, PutApiLogisticsPvtShippingPoliciesByIdResponses, RemoveBlockedDeliveryWindowsData, RemoveBlockedDeliveryWindowsResponses, RemoveWarehouseData, RemoveWarehouseResponses, ReservationByIdData, ReservationByIdResponses, ReservationbyWarehouseandSkuData, ReservationbyWarehouseandSkuResponses, RetrieveBlockedDeliveryWindowsData, RetrieveBlockedDeliveryWindowsResponses, SaveSupplyLotData, SaveSupplyLotResponses, TransferSupplyLotData, TransferSupplyLotResponses, UpdateInventoryBySkuandWarehouseData, UpdateInventoryBySkuandWarehouseErrors, UpdateInventoryBySkuandWarehouseResponses, WarehouseByIdData, WarehouseByIdResponses } from './types.gen'; export type Options = Options2 & { /** @@ -278,7 +278,7 @@ export const freightValues = (options: Opt { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, { name: 'VtexIdclientAutCookie', type: 'apiKey' } ], - url: '/api/logistics/pvt/configuration/freights/{carrierId}/{cep}/values', + url: '/api/logistics/pvt/configuration/freights/{carrierId}/{postalcode}/values', ...options }); @@ -839,7 +839,7 @@ export const inventoryBySku = (options: Op }); /** - * List inventory per warehouse + * List inventory by SKU per warehouse * * Lists [inventory](https://help.vtex.com/en/tutorial/inventory-management--tutorials_139) information, searching by [warehouse](https://help.vtex.com/en/tutorial/warehouse--6oIxvsVDTtGpO7y6zwhGpb) ID. * @@ -1138,6 +1138,10 @@ export const getinventorywithdispatchedreservations = (options: Opt * * Creates a new supply lot, which allows you to sell a SKU that is currently _out-of-stock_ in your [inventory](https://help.vtex.com/en/tutorial/inventory-management--tutorials_139) and unavailable for sales. Creating a supply lot is useful when you know the date of when the SKU will have quantity and availability for sales again. * + * In architectures with franchise accounts or multiple sellers, the scheduled lead time of supply lots is not considered during seller selection or SLA calculation, so this feature may not behave as expected in these scenarios. + * + * In architectures that use Delivery Promise, supply lots are not considered in the SLA calculation, which may cause divergences between the lead time configured in the supply lot and the lead time displayed to the shopper. + * * ## Permissions * * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: @@ -1214,6 +1222,10 @@ export const saveSupplyLot = (options: Opt * * Transfers a SKU from a supply lot to the currently available inventory. * + * In architectures with franchise accounts or multiple sellers, the scheduled lead time of supply lots is not considered during seller selection or SLA calculation, so this feature may not behave as expected in these scenarios. + * + * In architectures that use Delivery Promise, supply lots are not considered in the SLA calculation, which may cause divergences between the lead time configured in the supply lot and the lead time displayed to the shopper. + * * ## Permissions * * Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint: @@ -1244,6 +1256,204 @@ export const transferSupplyLot = (options: ...options }); +/** + * Create batch inventory job + * + * Creates a new batch inventory job and returns a pre-signed URL for uploading the CSV file. The batch will be in `AWAITING_UPLOAD` status until the CSV is uploaded and committed. + * + * >ℹ️ This feature is in early access, which means that we are working to improve it. If you want to use this feature, please contact our [Support Center](https://support.vtex.com/hc/en-us/requests). + * + * This endpoint is part of the Batch operations section for high-throughput [inventory updates](https://help.vtex.com/en/docs/tutorials/updating-the-quantity-of-items-in-inventory). Learn more about [inventory management at VTEX](https://help.vtex.com/en/docs/tutorials/managing-stock-items). + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/authentication-overview#api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise, they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Logistics | Logistics access | **Logistics - Full access** | + * + * You can [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) with that resource or use one of the following [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy): + * + * | **Role** | **Resource** | + * | --------------- | ----------------- | + * | Logistics - Full access | Logistics - Full access | + * | OMS - Full access | Logistics - Full access | + * + * >❗ Assigning a [predefined role](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) to users or API keys usually grants permission to multiple [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3). If some of these permissions are not necessary, consider creating a custom role instead. For more information regarding security, see [Best practices for using API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm). + * + * To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication-overview#machine-authentication). + */ +export const postAvailabilityV1InventoryBatch = (options: Options) => (options.client ?? client).post({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/availability/v1/inventory/batch', + ...options +}); + +/** + * Confirm batch inventory + * + * Confirms that the CSV upload is complete and triggers asynchronous processing of the batch inventory. The batch status will transition to `QUEUED`. + * + * >ℹ️ This feature is in early access, which means that we are working to improve it. If you want to use this feature, please contact our [Support Center](https://support.vtex.com/hc/en-us/requests). + * + * This endpoint is part of the Batch operations section for high-throughput [inventory updates](https://help.vtex.com/en/docs/tutorials/updating-the-quantity-of-items-in-inventory). Learn more about [inventory management at VTEX](https://help.vtex.com/en/docs/tutorials/managing-stock-items). + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/authentication-overview#api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise, they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Logistics | Logistics access | **Logistics - Full access** | + * + * You can [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) with that resource or use one of the following [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy): + * + * | **Role** | **Resource** | + * | --------------- | ----------------- | + * | Logistics - Full access | Logistics - Full access | + * | OMS - Full access | Logistics - Full access | + * + * >❗ Assigning a [predefined role](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) to users or API keys usually grants permission to multiple [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3). If some of these permissions are not necessary, consider creating a custom role instead. For more information regarding security, see [Best practices for using API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm). + * + * To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication-overview#machine-authentication). + */ +export const postAvailabilityV1InventoryBatchByBatchIdConfirm = (options: Options) => (options.client ?? client).post({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/availability/v1/inventory/batch/{batchId}/confirm', + ...options +}); + +/** + * Get batch inventory status + * + * Retrieves the current processing status and progress information for a batch inventory job. Use this endpoint to poll the batch status and track processing progress. + * + * >ℹ️ This feature is in early access, which means that we are working to improve it. If you want to use this feature, please contact our [Support Center](https://support.vtex.com/hc/en-us/requests). + * + * This endpoint is part of the Batch operations section for high-throughput [inventory updates](https://help.vtex.com/en/docs/tutorials/updating-the-quantity-of-items-in-inventory). Learn more about [inventory management at VTEX](https://help.vtex.com/en/docs/tutorials/managing-stock-items). + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/authentication-overview#api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise, they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Logistics | Logistics access | **Logistics - Full access** | + * + * You can [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) with that resource or use one of the following [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy): + * + * | **Role** | **Resource** | + * | --------------- | ----------------- | + * | Logistics - Full access | Logistics - Full access | + * | OMS - Full access | Logistics - Full access | + * + * >❗ Assigning a [predefined role](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) to users or API keys usually grants permission to multiple [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3). If some of these permissions are not necessary, consider creating a custom role instead. For more information regarding security, see [Best practices for using API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm). + * + * To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication-overview#machine-authentication). + */ +export const getAvailabilityV1InventoryBatchByBatchIdStatus = (options: Options) => (options.client ?? client).get({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/availability/v1/inventory/batch/{batchId}/status', + ...options +}); + +/** + * Get batch inventory errors + * + * Returns a pre-signed URL to download a CSV file containing all rows that failed processing, along with error codes and messages. The error reports are available until the batch metadata expires (7 days after batch completion). + * + * >ℹ️ This feature is in early access, which means that we are working to improve it. If you want to use this feature, please contact our [Support Center](https://support.vtex.com/hc/en-us/requests). + * + * This endpoint is part of the Batch operations section for high-throughput [inventory updates](https://help.vtex.com/en/docs/tutorials/updating-the-quantity-of-items-in-inventory). Learn more about [inventory management at VTEX](https://help.vtex.com/en/docs/tutorials/managing-stock-items). + * + * ## Endpoint Availability + * + * The Get batch inventory errors endpoint is available when: + * - `errorCount > 0` in the status response + * - [Status](https://developers.vtex.com/docs/api-reference/logistics-api#get-/availability/v1/inventory/batch/-batchId-/status) is one of: `PROCESSING`, `COMPLETED`, `COMPLETED_WITH_ERRORS`, or `FAILED` + * + * If these conditions are not met, the endpoint response will be `204 No Content`. + * + * ## Error Types + * + * **Deterministic Errors**: Errors caused by invalid or incomplete data in the submitted file, for example a missing required fields or invalid values. These errors are detected during the file ingestion from S3 and will cause the affected records to fail. The system doesn't retry these operations automatically. The user must fix the data in the CSV file and resubmit a new batch. + * + * **Non-Deterministic Errors**: Errors caused by infrastructure or system issues. The system will automatically retry the operation up to 3 times. If the operation still fails after these attempts, the message will be sent to a Dead Letter Queue (DLQ) for further investigation. These errors will show `UPDATE_FAILED` in the error CSV. + * + * ## Error CSV Schema + * + * The downloaded CSV file contains the following fields: + * + * | **Field** | **Type** | **Description** | + * | --------------- | ----------------- | ----------------- | + * | `line_number` | integer | Original line number in the uploaded CSV. | + * | `item_id` | string | SKU identifier from the failed row. | + * | `container_id` | string | Warehouse ID from the failed row. | + * | `error_code` | string | Machine-readable error code. | + * | `error_message` | string | Human-readable error description. | + * + * ## Error Codes + * + * - `INVALID_QUANTITY`: Quantity value is invalid (negative, non-numeric) + * - `MISSING_REQUIRED_FIELD`: Required field is empty or missing + * - `INVALID_DATE_FORMAT`: Date/time field has invalid format + * - `UPDATE_FAILED`: Database update failed after retries (non-deterministic error) + * - `INSERT_CONFLICT`: Insert conflicted with a concurrent operation + * - `INVALID_FORMAT`: Row format is invalid (e.g., wrong number of columns) + * - `CONFLICT`: Compare-And-Set conflict or per-item routing conflict + * - `UNKNOWN`: Unclassified error + * + * ## Error CSV Example + * + * ```csv + * line_number,item_id,container_id,error_code,error_message + * 1523,SKU-12345,WH-01,INVALID_QUANTITY,"quantity cannot be negative: -50" + * 4892,SKU-67890,WH-01,MISSING_REQUIRED_FIELD,"container_id is required" + * 10234,SKU-11111,WH-01,INVALID_DATE_FORMAT,"supply_date is not valid" + * ``` + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/authentication-overview#api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise, they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Logistics | Logistics access | **Logistics - Full access** | + * + * You can [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) with that resource or use one of the following [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy): + * + * | **Role** | **Resource** | + * | --------------- | ----------------- | + * | Logistics - Full access | Logistics - Full access | + * | OMS - Full access | Logistics - Full access | + * + * >❗ Assigning a [predefined role](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) to users or API keys usually grants permission to multiple [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3). If some of these permissions are not necessary, consider creating a custom role instead. For more information regarding security, see [Best practices for using API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm). + * + * To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication-overview#machine-authentication). + */ +export const getAvailabilityV1InventoryBatchByBatchIdErrors = (options: Options) => (options.client ?? client).get({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/availability/v1/inventory/batch/{batchId}/errors', + ...options +}); + /** * Delete holiday * diff --git a/vtex/server/generated/logistics/types.gen.ts b/vtex/server/generated/logistics/types.gen.ts index 35f830e0..5b714631 100644 --- a/vtex/server/generated/logistics/types.gen.ts +++ b/vtex/server/generated/logistics/types.gen.ts @@ -1,7 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts export type ClientOptions = { - baseUrl: 'https://{accountName}.{environment}.com.br' | (string & {}); + baseUrl: 'https://{accountName}.{environment}.com.br' | 'https://logistics.{environment}.com.br/{accountName}' | 'https://logistics.{environment}.com.br/{accountName}' | 'https://logistics.{environment}.com.br/{accountName}' | 'https://logistics.{environment}.com.br/{accountName}' | 'https://logistics.{environment}.com.br/{accountName}' | (string & {}); }; /** @@ -905,6 +905,11 @@ export type ContentType = string; */ export type Accept = string; +/** + * Unique identifier for the batch job, returned by the [Create batch inventory job](https://developers.vtex.com/docs/api-reference/logistics-api#post-/availability/v1/inventory/batch) endpoint. + */ +export type BatchId = string; + export type DeleteApiLogisticsPvtShippingPoliciesByIdData = { body?: never; headers: { @@ -1481,10 +1486,10 @@ export type FreightValuesData = { /** * Postal code of the area in which you wish to retrieve freight values for a given carrier, according to your [shipping rate template](https://help.vtex.com/en/tutorial/shipping-rate-template--tutorials_127) configurations. */ - cep: string; + postalcode: string; }; query?: never; - url: '/api/logistics/pvt/configuration/freights/{carrierId}/{cep}/values'; + url: '/api/logistics/pvt/configuration/freights/{carrierId}/{postalcode}/values'; }; export type FreightValuesResponses = { @@ -3003,6 +3008,390 @@ export type TransferSupplyLotResponses = { export type TransferSupplyLotResponse = TransferSupplyLotResponses[keyof TransferSupplyLotResponses]; +export type PostAvailabilityV1InventoryBatchData = { + body?: never; + headers: { + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path?: never; + query?: never; + url: '/availability/v1/inventory/batch'; +}; + +export type PostAvailabilityV1InventoryBatchErrors = { + /** + * Bad Request + * + * Invalid request or missing required path parameter. + */ + 400: unknown; + /** + * Unauthorized + * + * Missing or invalid authentication. + */ + 401: unknown; + /** + * Forbidden + * + * Insufficient permissions or feature not enabled for the account. + */ + 403: unknown; + /** + * Internal Server Error + * + * Unexpected error occurred while creating the batch. + */ + 500: unknown; +}; + +export type PostAvailabilityV1InventoryBatchResponses = { + /** + * Batch inventory job details. + */ + 201: { + /** + * Unique identifier for the batch inventory job. This value must be used as the name of the CSV file. + */ + batchId: string; + /** + * Initial status of the batch. + */ + status: 'AWAITING_UPLOAD'; + /** + * Pre-signed upload details for uploading the CSV file to S3. + */ + upload: { + /** + * HTTP method to use for the upload. + */ + method: 'PUT'; + /** + * Pre-signed S3 URL for uploading the CSV file. + */ + url: string; + /** + * Required headers for the upload request. + */ + headers: { + /** + * Content type for the upload. Must be `text/csv`. + */ + 'Content-Type': 'text/csv'; + }; + /** + * URL expiration timestamp. The pre-signed URL is valid for 30 minutes from the time it is returned. + */ + expiresAt: string; + }; + }; +}; + +export type PostAvailabilityV1InventoryBatchResponse = PostAvailabilityV1InventoryBatchResponses[keyof PostAvailabilityV1InventoryBatchResponses]; + +export type PostAvailabilityV1InventoryBatchByBatchIdConfirmData = { + body?: never; + headers: { + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path: { + /** + * Unique identifier for the batch job, returned by the [Create batch inventory job](https://developers.vtex.com/docs/api-reference/logistics-api#post-/availability/v1/inventory/batch) endpoint. + */ + batchId: string; + }; + query?: never; + url: '/availability/v1/inventory/batch/{batchId}/confirm'; +}; + +export type PostAvailabilityV1InventoryBatchByBatchIdConfirmErrors = { + /** + * Bad Request + * + * Batch already processing or invalid state. + */ + 400: unknown; + /** + * Unauthorized + * + * Missing or invalid authentication. + */ + 401: unknown; + /** + * Forbidden + * + * Insufficient permissions. + */ + 403: unknown; + /** + * Locked + * + * There is already a commit in progress for this batch. + */ + 423: unknown; + /** + * Internal Server Error + * + * Unexpected error occurred while committing the batch. + */ + 500: unknown; +}; + +export type PostAvailabilityV1InventoryBatchByBatchIdConfirmResponses = { + /** + * Accepted + * + * Upload confirmed and batch queued for processing. + */ + 202: unknown; +}; + +export type GetAvailabilityV1InventoryBatchByBatchIdStatusData = { + body?: never; + headers: { + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path: { + /** + * Unique identifier for the batch job, returned by the [Create batch inventory job](https://developers.vtex.com/docs/api-reference/logistics-api#post-/availability/v1/inventory/batch) endpoint. + */ + batchId: string; + }; + query?: never; + url: '/availability/v1/inventory/batch/{batchId}/status'; +}; + +export type GetAvailabilityV1InventoryBatchByBatchIdStatusErrors = { + /** + * Bad Request + * + * Invalid batch ID format. + */ + 400: unknown; + /** + * Unauthorized + * + * Missing or invalid authentication. + */ + 401: unknown; + /** + * Forbidden + * + * Insufficient permissions. + */ + 403: unknown; + /** + * Not Found + * + * Batch not found. + */ + 404: unknown; + /** + * Internal Server Error + * + * Unexpected error occurred while retrieving the batch status. + */ + 500: unknown; +}; + +export type GetAvailabilityV1InventoryBatchByBatchIdStatusResponses = { + /** + * Batch inventory status details. + */ + 200: { + /** + * Unique identifier for the batch inventory job. + */ + batchId: string; + /** + * Current processing status of the batch inventory. Possible values: + * + * - `AWAITING_UPLOAD`: Batch created, waiting for CSV upload. + * - `QUEUED`: Upload committed, waiting to begin processing. + * - `PROCESSING`: Batch is currently being processed (includes mid stages: `INGESTING`, `CLASSIFYING`). + * - `COMPLETED`: All rows processed successfully. + * - `COMPLETED_WITH_ERRORS`: Processing finished with some row errors. + * - `FAILED`: Processing failed due to validation or system errors. + * - `EXPIRED`: Batch metadata has expired (default: 30 minutes). + */ + status: 'AWAITING_UPLOAD' | 'QUEUED' | 'PROCESSING' | 'COMPLETED' | 'COMPLETED_WITH_ERRORS' | 'FAILED' | 'EXPIRED'; + /** + * Total number of rows in the batch. + */ + rowCount: number; + /** + * Number of rows processed so far. + */ + processedCount: number; + /** + * Number of rows with errors. + */ + errorCount: number; + /** + * Percentage of batch inventory completed. + */ + amountCompleted: number; + /** + * Batch inventory creation timestamp. + */ + createdAt: string; + /** + * Batch inventory processing start timestamp. + */ + startedAt?: string | null; + /** + * Chunk-level stage breakdown. May be `null` while the batch inventory is in early stages. + */ + stages?: { + /** + * Number of chunks that completed the ingestion stage for the batch inventory. + */ + ingestedChunks: number; + /** + * Number of chunks that completed the classification stage. + */ + classifiedChunks: number; + /** + * Number of chunks that completed the processing stage. + */ + processedChunks: number; + /** + * Number of chunks that completed the notification stage. + */ + notifiedChunks: number; + /** + * Total number of chunks in the batch. + */ + totalChunks: number; + } | null; + /** + * Processing outcome summary. May be `null` while the batch is in early stages. + */ + summary?: { + /** + * Number of new inventory rows inserted. + */ + insertCount: number; + /** + * Number of existing rows updated. + */ + updateCount: number; + /** + * Number of rows with no changes needed. + */ + noopCount: number; + /** + * Number of rows that encountered Compare-And-Set (CAS) conflicts. + */ + conflictCount: number; + /** + * Number of rows skipped as they were recently modified using the individual item API. + */ + skippedDueApiUpdateCount: number; + /** + * Number of rows routed to per-item processing. + */ + perItemRoutedCount: number; + /** + * Number of events sent to the Dead Letter Queue (DLQ). + */ + dlqEventsCount: number; + } | null; + }; +}; + +export type GetAvailabilityV1InventoryBatchByBatchIdStatusResponse = GetAvailabilityV1InventoryBatchByBatchIdStatusResponses[keyof GetAvailabilityV1InventoryBatchByBatchIdStatusResponses]; + +export type GetAvailabilityV1InventoryBatchByBatchIdErrorsData = { + body?: never; + headers: { + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path: { + /** + * Unique identifier for the batch job, returned by the [Create batch inventory job](https://developers.vtex.com/docs/api-reference/logistics-api#post-/availability/v1/inventory/batch) endpoint. + */ + batchId: string; + }; + query?: never; + url: '/availability/v1/inventory/batch/{batchId}/errors'; +}; + +export type GetAvailabilityV1InventoryBatchByBatchIdErrorsErrors = { + /** + * Bad Request + * + * Invalid batch ID format. + */ + 400: unknown; + /** + * Unauthorized + * + * Missing or invalid authentication. + */ + 401: unknown; + /** + * Forbidden + * + * Insufficient permissions. + */ + 403: unknown; + /** + * Not Found + * + * Batch not found. + */ + 404: unknown; + /** + * Internal Server Error + * + * Unexpected error occurred while retrieving the error report. + */ + 500: unknown; +}; + +export type GetAvailabilityV1InventoryBatchByBatchIdErrorsResponses = { + /** + * OK + * + * Error report available for download. + */ + 200: { + /** + * Unique identifier for the batch job. + */ + batchId: string; + /** + * Pre-signed URL to download the error CSV (valid for 60 minutes). + */ + downloadUrl: string; + /** + * Total number of rows with errors. + */ + errorCount: number; + }; + /** + * No Content + * + * No errors or report not available. + */ + 204: void; +}; + +export type GetAvailabilityV1InventoryBatchByBatchIdErrorsResponse = GetAvailabilityV1InventoryBatchByBatchIdErrorsResponses[keyof GetAvailabilityV1InventoryBatchByBatchIdErrorsResponses]; + export type HolidayData = { body?: never; headers: { diff --git a/vtex/server/generated/logistics/zod.gen.ts b/vtex/server/generated/logistics/zod.gen.ts index c27b4efb..c3c96c81 100644 --- a/vtex/server/generated/logistics/zod.gen.ts +++ b/vtex/server/generated/logistics/zod.gen.ts @@ -370,6 +370,11 @@ export const zContentType = z.string(); */ export const zAccept = z.string(); +/** + * Unique identifier for the batch job, returned by the [Create batch inventory job](https://developers.vtex.com/docs/api-reference/logistics-api#post-/availability/v1/inventory/batch) endpoint. + */ +export const zBatchId = z.uuid(); + export const zDeleteApiLogisticsPvtShippingPoliciesByIdData = z.object({ body: z.optional(z.never()), path: z.object({ @@ -582,7 +587,7 @@ export const zFreightValuesData = z.object({ body: z.optional(z.never()), path: z.object({ carrierId: z.string(), - cep: z.string() + postalcode: z.string() }), query: z.optional(z.never()), headers: z.object({ @@ -963,6 +968,48 @@ export const zTransferSupplyLotData = z.object({ }) }); +export const zPostAvailabilityV1InventoryBatchData = z.object({ + body: z.optional(z.never()), + path: z.optional(z.never()), + query: z.optional(z.never()), + headers: z.object({ + Accept: z.string() + }) +}); + +export const zPostAvailabilityV1InventoryBatchByBatchIdConfirmData = z.object({ + body: z.optional(z.never()), + path: z.object({ + batchId: z.uuid() + }), + query: z.optional(z.never()), + headers: z.object({ + Accept: z.string() + }) +}); + +export const zGetAvailabilityV1InventoryBatchByBatchIdStatusData = z.object({ + body: z.optional(z.never()), + path: z.object({ + batchId: z.uuid() + }), + query: z.optional(z.never()), + headers: z.object({ + Accept: z.string() + }) +}); + +export const zGetAvailabilityV1InventoryBatchByBatchIdErrorsData = z.object({ + body: z.optional(z.never()), + path: z.object({ + batchId: z.uuid() + }), + query: z.optional(z.never()), + headers: z.object({ + Accept: z.string() + }) +}); + export const zHolidayData = z.object({ body: z.optional(z.never()), path: z.object({ diff --git a/vtex/server/generated/marketplace-apis-suggestions/sdk.gen.ts b/vtex/server/generated/marketplace-apis-suggestions/sdk.gen.ts index 4a56a52c..3dad01a7 100644 --- a/vtex/server/generated/marketplace-apis-suggestions/sdk.gen.ts +++ b/vtex/server/generated/marketplace-apis-suggestions/sdk.gen.ts @@ -40,7 +40,15 @@ export type Options❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. */ -export const getautoApprovevaluefromconfig = (options: Options) => (options.client ?? client).get({ url: '/suggestions/configuration/autoapproval/toggle', ...options }); +export const getautoApprovevaluefromconfig = (options: Options) => (options.client ?? client).get({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/suggestions/configuration/autoapproval/toggle', + ...options +}); /** * Activate autoApprove in marketplace's account @@ -64,7 +72,15 @@ export const getautoApprovevaluefromconfig = ❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. */ -export const saveautoapproveforaccount = (options: Options) => (options.client ?? client).put({ url: '/suggestions/configuration/autoapproval/toggle', ...options }); +export const saveautoapproveforaccount = (options: Options) => (options.client ?? client).put({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/suggestions/configuration/autoapproval/toggle', + ...options +}); /** * Get account's approval settings @@ -102,7 +118,15 @@ export const saveautoapproveforaccount = ( * * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. */ -export const getaccountconfig = (options: Options) => (options.client ?? client).get({ url: '/suggestions/configuration', ...options }); +export const getaccountconfig = (options: Options) => (options.client ?? client).get({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/suggestions/configuration', + ...options +}); /** * Save account's approval settings @@ -126,7 +150,15 @@ export const getaccountconfig = (options: * * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. */ -export const saveaccountconfig = (options: Options) => (options.client ?? client).put({ url: '/suggestions/configuration', ...options }); +export const saveaccountconfig = (options: Options) => (options.client ?? client).put({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/suggestions/configuration', + ...options +}); /** * Get account's matcher settings @@ -152,7 +184,15 @@ export const saveaccountconfig = (options: * * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. */ -export const getmatchconfig = (options: Options) => (options.client ?? client).get({ url: '/suggestions/configuration/account/config', ...options }); +export const getmatchconfig = (options: Options) => (options.client ?? client).get({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/suggestions/configuration/account/config', + ...options +}); /** * Get seller's approval settings @@ -193,7 +233,15 @@ export const getmatchconfig = (options: Op * * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. */ -export const getselleraccountconfig = (options: Options) => (options.client ?? client).get({ url: '/suggestions/configuration/seller/{sellerId}', ...options }); +export const getselleraccountconfig = (options: Options) => (options.client ?? client).get({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/suggestions/configuration/seller/{sellerId}', + ...options +}); /** * Save seller's approval settings @@ -217,7 +265,15 @@ export const getselleraccountconfig = (opt * * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. */ -export const putselleraccountconfig = (options: Options) => (options.client ?? client).put({ url: '/suggestions/configuration/seller/{sellerId}', ...options }); +export const putselleraccountconfig = (options: Options) => (options.client ?? client).put({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/suggestions/configuration/seller/{sellerId}', + ...options +}); /** * Activate autoApprove setting for a seller @@ -239,7 +295,15 @@ export const putselleraccountconfig = (opt * * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. */ -export const saveautoapproveforaccountseller = (options: Options) => (options.client ?? client).put({ url: '/suggestions/configuration/autoapproval/toggle/seller/{sellerId}', ...options }); +export const saveautoapproveforaccountseller = (options: Options) => (options.client ?? client).put({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/suggestions/configuration/autoapproval/toggle/seller/{sellerId}', + ...options +}); /** * Get all SKU suggestions @@ -273,7 +337,15 @@ export const saveautoapproveforaccountseller = ❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. */ -export const getsuggestions = (options: Options) => (options.client ?? client).get({ url: '/suggestions', ...options }); +export const getsuggestions = (options: Options) => (options.client ?? client).get({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/suggestions', + ...options +}); /** * Delete SKU suggestion @@ -296,7 +368,15 @@ export const getsuggestions = (options: Op * * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. */ -export const deleteSuggestion = (options: Options) => (options.client ?? client).delete({ url: '/suggestions/{sellerId}/{sellerSkuId}', ...options }); +export const deleteSuggestion = (options: Options) => (options.client ?? client).delete({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/suggestions/{sellerId}/{sellerSkuId}', + ...options +}); /** * Get SKU suggestion by ID @@ -332,7 +412,15 @@ export const deleteSuggestion = (options: * * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. */ -export const getSuggestion = (options: Options) => (options.client ?? client).get({ url: '/suggestions/{sellerId}/{sellerSkuId}', ...options }); +export const getSuggestion = (options: Options) => (options.client ?? client).get({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/suggestions/{sellerId}/{sellerSkuId}', + ...options +}); /** * Send SKU suggestion @@ -357,7 +445,15 @@ export const getSuggestion = (options: Opt * * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. */ -export const saveSuggestion = (options: Options) => (options.client ?? client).put({ url: '/suggestions/{sellerId}/{sellerSkuId}', ...options }); +export const saveSuggestion = (options: Options) => (options.client ?? client).put({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/suggestions/{sellerId}/{sellerSkuId}', + ...options +}); /** * Get all versions @@ -384,7 +480,15 @@ export const saveSuggestion = (options: Op * * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. */ -export const getVersions = (options: Options) => (options.client ?? client).get({ url: '/suggestions/{sellerId}/{sellerskuid}/versions', ...options }); +export const getVersions = (options: Options) => (options.client ?? client).get({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/suggestions/{sellerId}/{sellerskuid}/versions', + ...options +}); /** * Get version by ID @@ -409,7 +513,15 @@ export const getVersions = (options: Optio * * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. */ -export const getSuggestionbyversion = (options: Options) => (options.client ?? client).get({ url: '/suggestions/{sellerId}/{sellerskuid}/versions/{version}', ...options }); +export const getSuggestionbyversion = (options: Options) => (options.client ?? client).get({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/suggestions/{sellerId}/{sellerskuid}/versions/{version}', + ...options +}); /** * Match received SKUs individually @@ -448,7 +560,15 @@ export const getSuggestionbyversion = (opt * * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. */ -export const match = (options: Options) => (options.client ?? client).put({ url: '/suggestions/{sellerId}/{sellerskuid}/versions/{version}/matches/{matchid}', ...options }); +export const match = (options: Options) => (options.client ?? client).put({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/suggestions/{sellerId}/{sellerskuid}/versions/{version}/matches/{matchid}', + ...options +}); /** * Match multiple received SKUs @@ -481,7 +601,15 @@ export const match = (options: Options❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. */ -export const matchMultiple = (options: Options) => (options.client ?? client).put({ url: '/suggestions/matches/action/{actionName}', ...options }); +export const matchMultiple = (options: Options) => (options.client ?? client).put({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/suggestions/matches/action/{actionName}', + ...options +}); /** * Map seller specifications to marketplace catalog @@ -507,4 +635,12 @@ export const matchMultiple = (options: Opt * * >ℹ️ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. */ -export const putSuggestionsConfigurationBySellerIdSpecifications = (options: Options) => (options.client ?? client).put({ url: '/suggestions/configuration/{sellerID}/specifications', ...options }); +export const putSuggestionsConfigurationBySellerIdSpecifications = (options: Options) => (options.client ?? client).put({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/suggestions/configuration/{sellerID}/specifications', + ...options +}); diff --git a/vtex/server/generated/marketplace-apis-suggestions/types.gen.ts b/vtex/server/generated/marketplace-apis-suggestions/types.gen.ts index 8a2464d2..39f34421 100644 --- a/vtex/server/generated/marketplace-apis-suggestions/types.gen.ts +++ b/vtex/server/generated/marketplace-apis-suggestions/types.gen.ts @@ -457,7 +457,15 @@ export type Sku = { * Weight of the SKU. */ weight: number; - images: Images; + /** + * An object that represents a single SKU image with a filename as the key and the image URL as the value. + */ + images: { + /** + * The URL of the SKU's image. Must be an `https` URL. + */ + 'imagem1.jpg'?: string; + }; /** * Unit multiplier for this SKU. If this information doesn't apply, you should use the default value 1. */ @@ -466,7 +474,15 @@ export type Sku = { * Measurement unit that should be used for this SKU. If this information doesn't apply, you should use the default value un. */ measurementUnit: string | null; - specifications: Specifications; + /** + * Object representing the specifications of a product, including details related to its packaging and other relevant attributes. + */ + specifications: { + /** + * Packaging specifications. Should include package's weight. + */ + Packaging: string; + }; }; /** @@ -1368,7 +1384,7 @@ export type MatchMultipleData = { /** * Array of objects representing multiple SKU or product match requests. */ - body: unknown; + body: MatchMultiple; headers: { /** * Describes the type of the content being sent. diff --git a/vtex/server/generated/marketplace-apis-suggestions/zod.gen.ts b/vtex/server/generated/marketplace-apis-suggestions/zod.gen.ts index 5109286b..83bc35c6 100644 --- a/vtex/server/generated/marketplace-apis-suggestions/zod.gen.ts +++ b/vtex/server/generated/marketplace-apis-suggestions/zod.gen.ts @@ -154,20 +154,6 @@ export const zProduct = z.object({ ]) }); -/** - * An object that represents a single SKU image with a filename as the key and the image URL as the value. - */ -export const zImages = z.object({ - 'imagem1.jpg': z.optional(z.string()) -}); - -/** - * Object representing the specifications of a product, including details related to its packaging and other relevant attributes. - */ -export const zSpecifications = z.object({ - Packaging: z.string() -}); - /** * Represents the SKU (Stock Keeping Unit) details for a product. The SKU is a unique identifier that contains specific attributes such as dimensions, weight, and other product specific information. This object is crucial for defining and managing the individual variations of a product in the catalog. */ @@ -185,13 +171,17 @@ export const zSku = z.object({ width: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }), length: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }), weight: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }), - images: zImages, + images: z.object({ + 'imagem1.jpg': z.optional(z.string()) + }), unitMultiplier: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }).default(1), measurementUnit: z.union([ z.string().default('un'), z.null() ]).default('un'), - specifications: zSpecifications + specifications: z.object({ + Packaging: z.string() + }) }); /** @@ -213,6 +203,20 @@ export const zMatchRequest = z.object({ sku: z.optional(zSku) }); +/** + * An object that represents a single SKU image with a filename as the key and the image URL as the value. + */ +export const zImages = z.object({ + 'imagem1.jpg': z.optional(z.string()) +}); + +/** + * Object representing the specifications of a product, including details related to its packaging and other relevant attributes. + */ +export const zSpecifications = z.object({ + Packaging: z.string() +}); + /** * An array containing multiple match operations, each represented as an object. This array allows for the processing of multiple SKU suggestions in a single request. */ @@ -515,7 +519,7 @@ export const zMatchData = z.object({ }); export const zMatchMultipleData = z.object({ - body: z.unknown(), + body: zMatchMultiple, path: z.object({ accountName: z.string(), actionName: z.enum([ diff --git a/vtex/server/generated/marketplace-protocol-external-marketplace-orders/index.ts b/vtex/server/generated/marketplace-protocol-external-marketplace-orders/index.ts index 3b743a83..9f3478d6 100644 --- a/vtex/server/generated/marketplace-protocol-external-marketplace-orders/index.ts +++ b/vtex/server/generated/marketplace-protocol-external-marketplace-orders/index.ts @@ -1,4 +1,4 @@ // This file is auto-generated by @hey-api/openapi-ts export { authorizeDispatchForFulfillmentOrder, enqueueNewOrder, fulfillmentSimulationExternalMarketplace, type Options, placeFulfillmentOrder, updateOrderStatus } from './sdk.gen'; -export type { Approveorder, AuthorizeDispatchForFulfillmentOrderData, AuthorizeDispatchForFulfillmentOrderResponse, AuthorizeDispatchForFulfillmentOrderResponses, ClientOptions, ClientProfileData, CustomApp, CustomData, Deliverybyfranchiseseller, Deliverybyseller, DeliveryIds, EnqueueNewOrderData, EnqueueNewOrderRequest, EnqueueNewOrderResponse, EnqueueNewOrderResponses, Fields, FulfillmentSimulationExternalMarketplaceData, FulfillmentSimulationExternalMarketplaceResponse, FulfillmentSimulationExternalMarketplaceResponses, GeoCoordinates, InvoiceData, Item, LogisticsInfo, OrderIdFulfillmentResponse, PlaceFulfillmentOrderData, PlaceFulfillmentOrderRequest, PlaceFulfillmentOrderResponse, PlaceFulfillmentOrderResponse2, PlaceFulfillmentOrderResponses, SelectedAddress, ShippingData, UpdateOrderStatusData, UpdateOrderStatusRequest, UpdateOrderStatusResponse, UpdateOrderStatusResponses, UserPaymentInfo } from './types.gen'; +export type { Approveorder, AuthorizeDispatchForFulfillmentOrderData, AuthorizeDispatchForFulfillmentOrderResponse, AuthorizeDispatchForFulfillmentOrderResponses, ClientOptions, ClientProfileData, CustomApp, CustomData, Deliverybyfranchiseseller, Deliverybyseller, DeliveryIds, EnqueueNewOrderData, EnqueueNewOrderRequest, EnqueueNewOrderResponse, EnqueueNewOrderResponses, Fields, FulfillmentSimulationExternalMarketplaceData, FulfillmentSimulationExternalMarketplaceResponse, FulfillmentSimulationExternalMarketplaceResponses, GeoCoordinates, InvoiceData, Item, LogisticsInfo, OrderIdFulfillmentResponse, PlaceFulfillmentOrderData, PlaceFulfillmentOrderRequest, PlaceFulfillmentOrderResponse, PlaceFulfillmentOrderResponse2, PlaceFulfillmentOrderResponses, SelectedAddress, ShippingData, TaxData, TrackingHint, UpdateOrderStatusData, UpdateOrderStatusRequest, UpdateOrderStatusResponse, UpdateOrderStatusResponses, UserPaymentInfo } from './types.gen'; diff --git a/vtex/server/generated/marketplace-protocol-external-marketplace-orders/types.gen.ts b/vtex/server/generated/marketplace-protocol-external-marketplace-orders/types.gen.ts index e53b488f..d447153e 100644 --- a/vtex/server/generated/marketplace-protocol-external-marketplace-orders/types.gen.ts +++ b/vtex/server/generated/marketplace-protocol-external-marketplace-orders/types.gen.ts @@ -13,53 +13,53 @@ export type EnqueueNewOrderRequest = { */ marketplaceOrderId: string; /** - * Required field including a string with the order’s status in the marketplace. If you send an order with the status APPROVED to integrate, our service will automatically try to advance it’s status in VTEX after integrating it. This field accepts the following values: - * - * - `new` - * - * - `approved` + * String with the identifier code of the connector responsible for the order. This field is optional if the connector uses the App Template and authenticates via `VtexIdclientAutCookie`. + */ + connectorName?: string; + /** + * String with the connector's base endpoint that will receive notifications about the order's processing results and status updates from VTEX OMS. + */ + connectorEndpoint?: string; + /** + * Order's status in the marketplace. Accepts the values: `new` and `approved`. */ marketplaceOrderStatus: string; /** - * Integer that indicates the order’s total value, which the marketplace will pay to the seller. It’s important to note that this value should include interest, if that’s the case. If the value is `USD110.50`, convert it to the format → `11050`. + * Integer that indicates the order's total value, which the marketplace will pay to the seller. Includes interest, if applicable. If the value is `USD110.50`, convert it to `11050`. */ marketplacePaymentValue: number; /** - * String with the identifier code of the connector responsible for the order. - * - * This field is optional if the connector uses the [App Template](https://developers.vtex.com/vtex-rest-api/docs/external-marketplace-integration-app-template) and authenticates on our request via `VtexIdclientAutCookie`. - * - * It is required if the connector is native or does not use the App Template. + * Integer with the interest amount included in the order's total value. If the value is `USD10.50`, convert it to `1050`. */ - connectorName?: string; + marketplaceInterestValue?: number; /** - * String with the connector's base endpoint that will receive notifications about the orders processing results, as well as status updates from VTEX OMS. This field accepts query strings. You can use the models below: - * - * - `https://{{externalconnector}}.com` - * - * - `https://{{externalconnector.com}}/api/vtex` if you additionaly want to send a relative URL with the endpoint. - * - * This field is optional if the connector uses the [App Template](https://developers.vtex.com/vtex-rest-api/docs/external-marketplace-integration-app-template) and authenticates on our request via `VtexIdclientAutCookie`. - * - * It is required if the connector is native or does not use the App Template. + * Decimal value with the allowed price divergence rate between the marketplace and the seller's prices. */ - connectorEndpoint?: string; + priceDivergenceAllowanceRate?: number; /** - * Boolean indicating whether franchise accounts linked to the main seller should be considered. That is, if the order delivery pickup/SLA can belong to a [franchise account](https://help.vtex.com/en/tutorial/what-is-a-franchise-account--kWQC6RkFSCUFGgY5gSjdl), for example. This field is optional and defaults to `false`. + * Boolean indicating whether franchise accounts linked to the main seller should be considered. Optional, defaulting to `false`. */ allowFranchises: boolean; /** - * String that indicates the name of the account responsible for the order’s pickup point. It is only required for pickup-in-point orders from franchise accounts, when franchise accounts `allowFranchises` is `true` and the order in question has a `pickup-in-point` delivery type. It is optional otherwise. + * String that indicates the name of the account responsible for the order's pickup point. Required only for pickup-in-point orders from franchise accounts. */ pickupAccountName?: string; /** - * List of items included in the order. Each item object references the schema definition for an individual item. + * List of items included in the order. */ items: Array; clientProfileData: ClientProfileData; shippingData: ShippingData; invoiceData: InvoiceData; customData?: CustomData; + /** + * List of tax information per SKU in the order. + */ + taxData?: Array; + /** + * String with additional free-text information about the order. + */ + openTextField?: string; }; /** @@ -132,24 +132,24 @@ export type ClientProfileData = { export type ShippingData = { /** * List that references the SLAs responsible for delivering each item in the order. - * - * This list must contain the same number of items as the `items` list, previously defined. For example: if the order contains 3 SKUs, you must describe 3 SLAs in this list, one for each SKU (even in cases where the same SLA will deliver all of them). - * - * The order of the SLAs in this list must also follow the same order as in the `items` list. For example: if the SLA named **Correios Express** will be responsible for delivering the SKU with ID equal to **1015**, which is found at index 0 of the `items` list, it must be in index 0 of the `logisticsInfo` list as well. */ logisticsInfo: Array; /** - * List of selected addresses for the order. Each address contains detailed information such as receiver name, postal code, city, state, country, street, number, neighborhood, complement, and geographical coordinates. + * List of selected addresses for the order. */ selectedAddresses: Array; /** - * Boolean that indicates whether the order's delivery is the marketplace responsibility. Optional, defaulting to false. + * Boolean that indicates whether the order's delivery is the marketplace responsibility. Optional, defaulting to `false`. */ isFob: boolean; /** - * Boolean that indicates whether the order's inventory in warehouse is the marketplace's responsibility. Optional, defaulting to false. + * Boolean that indicates whether the order's inventory in warehouse is the marketplace's responsibility. Optional, defaulting to `false`. */ isMarketplaceFulfillment: boolean; + /** + * List of tracking information hints for the order's shipments. + */ + trackingHints?: Array; }; /** @@ -200,11 +200,14 @@ export type LogisticsInfo = { * Example formats: `12d`, `5bd`, `3h`, `50m`. */ shippingEstimate: string; - deliveryIds: DeliveryIds; + /** + * List of delivery IDs, used for orders where the marketplace is responsible for the fulfillment of the order. + */ + deliveryIds: Array; }; /** - * List of delivery IDs, used for orders where the marketplace is responsible for the fulfillment of the order, including keeping inventory at a warehouse as well as the delivery. + * Object with the delivery ID information for orders where the marketplace is responsible for the fulfillment of the order, including keeping inventory at a warehouse as well as the delivery. */ export type DeliveryIds = { /** @@ -269,15 +272,13 @@ export type SelectedAddress = { */ export type GeoCoordinates = { /** - * Double value with the latitude coordinates of the address. Required only if the geoCoordinates field is defined. - * - * Example format: `-25.4158764`. + * Double value with the latitude coordinates of the address. Required only if the `geoCoordinates` field is defined. */ - latitude: string; + latitude: number; /** - * Double value with the longitude coordinates of the address. Required only if the geoCoordinates field is defined. Example format: `-49.342759`. + * Double value with the longitude coordinates of the address. Required only if the `geoCoordinates` field is defined. */ - longitude: string; + longitude: number; }; /** @@ -390,33 +391,20 @@ export type Deliverybyseller = { description: string; }> | null; /** - * Structure with important fields for the connector. This structure is only returned if the response is successful. Includes the following fields: - * - * `mainOrderId`: String with the order's ID inside the main seller account in VTEX. - * - * `franchiseOrderId`: - String with the order's ID inside the franchise seller account in VTEX. Only returned if the order was integrated using the [Multilevel Omnichannel Inventory](https://help.vtex.com/en/tutorial/multilevel-omnichannel-inventory--7M1xyCZWUyCB7PcjNtOyw4) feature, that is: - * - * - `allowFranchises` field set to `true` when integrating the order - * - * - `SLA` chosen for the order is from a franchise account. + * Structure with important fields for the connector. This structure is only returned if the response is successful. */ fields: { /** - * Additional fields associated with the request. + * String with the order’s ID inside the main seller account in VTEX. */ - fields?: { - /** - * String with the order’s ID inside the main seller account in VTEX. - */ - mainOrderId: string; - /** - * String with the order's ID inside the franchise seller account in VTEX. Only returned if the order was integrated using the [Multilevel Omnichannel Inventory](https://help.vtex.com/en/tutorial/multilevel-omnichannel-inventory--7M1xyCZWUyCB7PcjNtOyw4) feature, that is: - * - * - `allowFranchises` field set to `true` when integrating the order - * - SLA chosen for the order is from a franchise account - */ - franchiseOrderId?: string; - }; + mainOrderId: string; + /** + * String with the order's ID inside the franchise seller account in VTEX. Only returned if the order was integrated using the [Multilevel Omnichannel Inventory](https://help.vtex.com/en/tutorial/multilevel-omnichannel-inventory--7M1xyCZWUyCB7PcjNtOyw4) feature, that is: + * + * - `allowFranchises` field set to `true` when integrating the order + * - SLA chosen for the order is from a franchise account. + */ + franchiseOrderId?: string; } | null; /** * String with a message explaining the code returned in the response. @@ -482,33 +470,20 @@ export type Deliverybyfranchiseseller = { description: string; }> | null; /** - * Structure with important fields for the connector. This structure is only returned if the response is successful. Includes the following fields: - * - * `mainOrderId`: String with the order's ID inside the main seller account in VTEX. - * - * `franchiseOrderId`: - String with the order's ID inside the franchise seller account in VTEX. Only returned if the order was integrated using the [Multilevel Omnichannel Inventory](https://help.vtex.com/en/tutorial/multilevel-omnichannel-inventory--7M1xyCZWUyCB7PcjNtOyw4) feature, that is: - * - * - `allowFranchises` field set to `true` when integrating the order - * - * - `SLA` chosen for the order is from a franchise account. + * Structure with important fields for the connector. This structure is only returned if the response is successful. */ fields: { /** - * Object containing fields related to the order. + * String with the order’s ID inside the main seller account in VTEX. */ - fields?: { - /** - * String with the order’s ID inside the main seller account in VTEX. - */ - mainOrderId: string; - /** - * String with the order's ID inside the franchise seller account in VTEX. Only returned if the order was integrated using the [Multilevel Omnichannel Inventory](https://help.vtex.com/en/tutorial/multilevel-omnichannel-inventory--7M1xyCZWUyCB7PcjNtOyw4) feature, that is: - * - * - `allowFranchises` field set to `true` when integrating the order - * - SLA chosen for the order is from a franchise account - */ - franchiseOrderId?: string; - }; + mainOrderId: string; + /** + * String with the order's ID inside the franchise seller account in VTEX. Only returned if the order was integrated using the [Multilevel Omnichannel Inventory](https://help.vtex.com/en/tutorial/multilevel-omnichannel-inventory--7M1xyCZWUyCB7PcjNtOyw4) feature, that is: + * + * - `allowFranchises` field set to `true` when integrating the order + * - SLA chosen for the order is from a franchise account. + */ + franchiseOrderId?: string; } | null; /** * String with a message explaining the code returned in the response. @@ -1352,6 +1327,42 @@ export type PlaceFulfillmentOrderResponse = { }; }; +/** + * Object with tax information for a specific SKU in the order. + */ +export type TaxData = { + /** + * String with the SKU ID in VTEX's catalog. + */ + skuId: string; + /** + * Integer with the tax value applied to the SKU. If the value is `USD1.50`, convert it to `150`. + */ + value: number; +}; + +/** + * Object with tracking information hints for the order's shipment. + */ +export type TrackingHint = { + /** + * String with the shipment tracking identifier. + */ + trackingId: string; + /** + * String with the name of the courier responsible for the delivery. + */ + courierName: string; + /** + * String with the URL to track the shipment. + */ + trackingUrl?: string; + /** + * String with the label or display name for the tracking. + */ + trackingLabel?: string; +}; + export type PlaceFulfillmentOrderData = { body?: PlaceFulfillmentOrderRequest; headers: { diff --git a/vtex/server/generated/marketplace-protocol-external-marketplace-orders/zod.gen.ts b/vtex/server/generated/marketplace-protocol-external-marketplace-orders/zod.gen.ts index 7f3bd0c4..de46a1ff 100644 --- a/vtex/server/generated/marketplace-protocol-external-marketplace-orders/zod.gen.ts +++ b/vtex/server/generated/marketplace-protocol-external-marketplace-orders/zod.gen.ts @@ -43,7 +43,7 @@ export const zClientProfileData = z.object({ }); /** - * List of delivery IDs, used for orders where the marketplace is responsible for the fulfillment of the order, including keeping inventory at a warehouse as well as the delivery. + * Object with the delivery ID information for orders where the marketplace is responsible for the fulfillment of the order, including keeping inventory at a warehouse as well as the delivery. */ export const zDeliveryIds = z.object({ warehouseId: z.string() @@ -62,15 +62,15 @@ export const zLogisticsInfo = z.object({ selectedSla: z.string(), lockTTL: z.string(), shippingEstimate: z.string(), - deliveryIds: zDeliveryIds + deliveryIds: z.array(zDeliveryIds) }); /** * Structure with the address geocoordinates. Optional for `delivery` orders, required for `pickup-in-point` orders. */ export const zGeoCoordinates = z.object({ - latitude: z.string(), - longitude: z.string() + latitude: z.number(), + longitude: z.number() }); /** @@ -91,16 +91,6 @@ export const zSelectedAddress = z.object({ geoCoordinates: z.optional(zGeoCoordinates) }); -/** - * Object containing shipping information for the order. - */ -export const zShippingData = z.object({ - logisticsInfo: z.array(zLogisticsInfo), - selectedAddresses: z.array(zSelectedAddress), - isFob: z.boolean(), - isMarketplaceFulfillment: z.boolean() -}); - /** * Structure with the order’s payment data. Required only if `invoiceData` is defined. */ @@ -138,24 +128,6 @@ export const zCustomData = z.object({ customApps: z.array(zCustomApp) }); -/** - * Object for enqueueing a new order. - */ -export const zEnqueueNewOrderRequest = z.object({ - marketplaceOrderId: z.string(), - marketplaceOrderStatus: z.string(), - marketplacePaymentValue: z.int(), - connectorName: z.optional(z.string()), - connectorEndpoint: z.optional(z.string()), - allowFranchises: z.boolean(), - pickupAccountName: z.optional(z.string()), - items: z.array(zItem), - clientProfileData: zClientProfileData, - shippingData: zShippingData, - invoiceData: zInvoiceData, - customData: z.optional(zCustomData) -}); - /** * Object for delivery by seller integration. */ @@ -188,10 +160,8 @@ export const zDeliverybyseller = z.object({ ]), fields: z.union([ z.object({ - fields: z.optional(z.object({ - mainOrderId: z.string(), - franchiseOrderId: z.optional(z.string()) - })) + mainOrderId: z.string(), + franchiseOrderId: z.optional(z.string()) }), z.null() ]), @@ -224,10 +194,8 @@ export const zDeliverybyfranchiseseller = z.object({ ]), fields: z.union([ z.object({ - fields: z.optional(z.object({ - mainOrderId: z.string(), - franchiseOrderId: z.optional(z.string()) - })) + mainOrderId: z.string(), + franchiseOrderId: z.optional(z.string()) }), z.null() ]), @@ -518,6 +486,57 @@ export const zPlaceFulfillmentOrderResponse = z.object({ })) }); +/** + * Object with tax information for a specific SKU in the order. + */ +export const zTaxData = z.object({ + skuId: z.string(), + value: z.int() +}); + +/** + * Object with tracking information hints for the order's shipment. + */ +export const zTrackingHint = z.object({ + trackingId: z.string(), + courierName: z.string(), + trackingUrl: z.optional(z.url()), + trackingLabel: z.optional(z.string()) +}); + +/** + * Object containing shipping information for the order. + */ +export const zShippingData = z.object({ + logisticsInfo: z.array(zLogisticsInfo), + selectedAddresses: z.array(zSelectedAddress), + isFob: z.boolean(), + isMarketplaceFulfillment: z.boolean(), + trackingHints: z.optional(z.array(zTrackingHint)) +}); + +/** + * Object for enqueueing a new order. + */ +export const zEnqueueNewOrderRequest = z.object({ + marketplaceOrderId: z.string(), + connectorName: z.optional(z.string()), + connectorEndpoint: z.optional(z.string()), + marketplaceOrderStatus: z.string(), + marketplacePaymentValue: z.int(), + marketplaceInterestValue: z.optional(z.int()), + priceDivergenceAllowanceRate: z.optional(z.number()), + allowFranchises: z.boolean(), + pickupAccountName: z.optional(z.string()), + items: z.array(zItem), + clientProfileData: zClientProfileData, + shippingData: zShippingData, + invoiceData: zInvoiceData, + customData: z.optional(zCustomData), + taxData: z.optional(z.array(zTaxData)), + openTextField: z.optional(z.string()) +}); + export const zPlaceFulfillmentOrderData = z.object({ body: z.optional(zPlaceFulfillmentOrderRequest), path: z.object({ diff --git a/vtex/server/generated/marketplace-protocol-external-seller-fulfillment/index.ts b/vtex/server/generated/marketplace-protocol-external-seller-fulfillment/index.ts index 6ec3254e..df8186c6 100644 --- a/vtex/server/generated/marketplace-protocol-external-seller-fulfillment/index.ts +++ b/vtex/server/generated/marketplace-protocol-external-seller-fulfillment/index.ts @@ -1,4 +1,4 @@ // This file is auto-generated by @hey-api/openapi-ts export { authorizeFulfillment, fulfillmentSimulation, mkpOrderCancellation, type Options, orderPlacement } from './sdk.gen'; -export type { Accept, AcceptEnconding, Authorization, AuthorizeFulfillmentData, AuthorizeFulfillmentResponse, AuthorizeFulfillmentResponses, BundleItemsItem, ClientOptions, ContentLength, ContentType, ForwardedFor, ForwardedProto, FulfillmentEndpoint, FulfillmentItem, FulfillmentSimulationData, FulfillmentSimulationResponse, FulfillmentSimulationResponses, ItemAttachment, MkpOrderCancellationData, MkpOrderCancellationResponse, MkpOrderCancellationResponses, OrderId, OrderPlacement, OrderPlacementData, OrderPlacementResponse, OrderPlacementResponses, RepsonseOrderId, RequestFulfillmentSimulation, RequestOrderId, ResponseFulfillmentSimulation, ResponseOrderPlacement, SellerOrderId, Traceparent, VtexCacheClientBypass, VtexOperationId } from './types.gen'; +export type { Accept, AcceptEnconding, Authorization, AuthorizeFulfillmentData, AuthorizeFulfillmentResponse, AuthorizeFulfillmentResponses, BundleItemsItem, ClientOptions, ConnectorResponses, ContentLength, ContentType, ForwardedFor, ForwardedProto, FulfillmentEndpoint, FulfillmentItem, FulfillmentSimulationData, FulfillmentSimulationResponse, FulfillmentSimulationResponses, ItemAttachment, MkpOrderCancellationData, MkpOrderCancellationResponse, MkpOrderCancellationResponses, OrderId, OrderPlacement, OrderPlacementData, OrderPlacementResponse, OrderPlacementResponses, RepsonseOrderId, RequestFulfillmentSimulation, RequestOrderId, ResponseFulfillmentSimulation, ResponseOrderPlacement, SellerOrderId, Traceparent, VtexCacheClientBypass, VtexOperationId } from './types.gen'; diff --git a/vtex/server/generated/marketplace-protocol-external-seller-fulfillment/types.gen.ts b/vtex/server/generated/marketplace-protocol-external-seller-fulfillment/types.gen.ts index 68556389..3f2feed2 100644 --- a/vtex/server/generated/marketplace-protocol-external-seller-fulfillment/types.gen.ts +++ b/vtex/server/generated/marketplace-protocol-external-seller-fulfillment/types.gen.ts @@ -1053,6 +1053,41 @@ export type RequestOrderId = { * When set as `true`, the cancellation was requested by the shopper, and when set as `false`, the cancellation was not requested by the shopper. */ requestedByUser: boolean; + /** + * Payments information. + */ + paymentData?: { + /** + * Array containing information about payments. + */ + payments?: Array<{ + /** + * Payment system ID. + */ + paymentSystem?: string; + /** + * Payment system name. + */ + paymentSystemName?: string; + /** + * Order total payment value in cents. + */ + value?: number; + /** + * Number of payment installments. + */ + installments?: number; + /** + * Total payment reference value in cents. + */ + referenceValue?: number; + /** + * Transaction payment method, which can be credit card, debit card, bank invoice, promissory, gift card or pix (`instantPayment`). + */ + group?: 'creditCard' | 'debitCard' | 'bankInvoice' | 'promissory' | 'giftCard' | 'instantPayment'; + }>; + connectorResponses?: ConnectorResponses; + }; }; /** @@ -1085,6 +1120,64 @@ export type RepsonseOrderId = { receipt?: string; }; +/** + * Payment provider (connector) responses. The fields within this object can vary according to the order payment provider. + */ +export type ConnectorResponses = { + /** + * Provider operational message or error to be logged. + */ + Message?: string | null; + /** + * Provider unique identifier for the transaction. + */ + tid?: string | null; + /** + * Provider authorization ID. + */ + authorizationId?: string | null; + /** + * Order payment status in the [transaction flow](https://help.vtex.com/docs/tracks/the-transaction-flow). + */ + status?: string | null; + /** + * Total time (in seconds) before the auto settle, when the platform makes an automatic call to `/settlements`, regardless if the payment was approved by the merchant's anti-fraud provider. The maximum value allowed is `604800` seconds (7 days). + */ + delayToAutoSettle?: number | null; + /** + * Provider operational return code or error to be logged. + */ + ReturnCode?: string | null; + /** + * Provider unique sequential number for the transaction. + */ + nsu?: string; + /** + * Provider operational code or error to be logged. + */ + code?: string; + /** + * Provider operational message or error to be logged. + */ + message?: string; + /** + * [Acquirer](https://help.vtex.com/docs/tracks/how-the-payments-module-works#acquirer) name (mostly used for card payments). + */ + acquirer?: string; + /** + * Provider unique identifier for the transaction. + */ + authId?: string; + /** + * Payment ID. + */ + paymentId?: string; + /** + * Total time (in seconds) before the auto settle, when the platform makes an automatic call to `/settlements`. This happens only after the payment was approved by the merchant's anti-fraud provider. + */ + delayToAutoSettleAfterAntifraud?: string; +}; + /** * This is the fulfillment endpoint registered for each specific external seller in the **seller management** section of VTEX's admin panel. */ diff --git a/vtex/server/generated/marketplace-protocol-external-seller-fulfillment/zod.gen.ts b/vtex/server/generated/marketplace-protocol-external-seller-fulfillment/zod.gen.ts index de6c5869..4e839fa9 100644 --- a/vtex/server/generated/marketplace-protocol-external-seller-fulfillment/zod.gen.ts +++ b/vtex/server/generated/marketplace-protocol-external-seller-fulfillment/zod.gen.ts @@ -334,6 +334,53 @@ export const zResponseFulfillmentSimulation = z.object({ allowMultipleDeliveries: z.optional(z.boolean()) }); +/** + * Details related to an order, including the order approval date, marketplace order ID, order number, and order receipt code. + */ +export const zRepsonseOrderId = z.object({ + date: z.optional(z.string()), + marketplaceOrderId: z.optional(z.string()), + orderId: z.optional(z.string()), + receipt: z.optional(z.string()) +}); + +/** + * Payment provider (connector) responses. The fields within this object can vary according to the order payment provider. + */ +export const zConnectorResponses = z.object({ + Message: z.optional(z.union([ + z.string(), + z.null() + ])), + tid: z.optional(z.union([ + z.string(), + z.null() + ])), + authorizationId: z.optional(z.union([ + z.string(), + z.null() + ])), + status: z.optional(z.union([ + z.string(), + z.null() + ])), + delayToAutoSettle: z.optional(z.union([ + z.int(), + z.null() + ])), + ReturnCode: z.optional(z.union([ + z.string(), + z.null() + ])), + nsu: z.optional(z.string()), + code: z.optional(z.string()), + message: z.optional(z.string()), + acquirer: z.optional(z.string()), + authId: z.optional(z.string()), + paymentId: z.optional(z.string()), + delayToAutoSettleAfterAntifraud: z.optional(z.string()) +}); + /** * Details related to a request for an order ID, which is used to trigger the fulfillment process of the corresponding order. */ @@ -343,17 +390,25 @@ export const zRequestOrderId = z.object({ cancellationRequestId: z.string(), cancellationRequestDate: z.string(), reason: z.string(), - requestedByUser: z.boolean() -}); - -/** - * Details related to an order, including the order approval date, marketplace order ID, order number, and order receipt code. - */ -export const zRepsonseOrderId = z.object({ - date: z.optional(z.string()), - marketplaceOrderId: z.optional(z.string()), - orderId: z.optional(z.string()), - receipt: z.optional(z.string()) + requestedByUser: z.boolean(), + paymentData: z.optional(z.object({ + payments: z.optional(z.array(z.object({ + paymentSystem: z.optional(z.string()), + paymentSystemName: z.optional(z.string()), + value: z.optional(z.int()), + installments: z.optional(z.int()), + referenceValue: z.optional(z.int()), + group: z.optional(z.enum([ + 'creditCard', + 'debitCard', + 'bankInvoice', + 'promissory', + 'giftCard', + 'instantPayment' + ])) + }))), + connectorResponses: z.optional(zConnectorResponses) + })) }); /** diff --git a/vtex/server/generated/masterdata-api-v10-2/sdk.gen.ts b/vtex/server/generated/masterdata-api-v10-2/sdk.gen.ts index 3a21039d..27bd556a 100644 --- a/vtex/server/generated/masterdata-api-v10-2/sdk.gen.ts +++ b/vtex/server/generated/masterdata-api-v10-2/sdk.gen.ts @@ -110,6 +110,8 @@ export const createorupdatepartialdocument = ⚠️ Do not use Master Data as a log, cache, or temporary data store. Writing high volumes of disposable data can trigger API throttling and degrade store performance. + * * >ℹ️ You can use this request to create documents in any given data entity. Because of this, you are not restricted to using the fields exemplified below in your requests. But you should be aware of the fields allowed or required for each document you wish to update. * * ## Custom field types diff --git a/vtex/server/generated/organization-units/sdk.gen.ts b/vtex/server/generated/organization-units/sdk.gen.ts index f457f0bf..7cf824ae 100644 --- a/vtex/server/generated/organization-units/sdk.gen.ts +++ b/vtex/server/generated/organization-units/sdk.gen.ts @@ -102,7 +102,7 @@ export const getApiOrganizationUnitsV1 = ( /** * Create organization unit * - * Creates a new organization unit at the root level of the organizational hierarchy. + * Creates a new organization unit at the root level of the organizational hierarchy. After creation, you can move the organization unit to a desired parent using the `PUT` [Move organization unit](https://developers.vtex.com/docs/api-reference/organization-units-api#put-/api/organization-units/v1/-organizationUnitId-/path) endpoint. * * >⚠️ This feature is only available for stores using B2B Buyer Portal, which is currently available to select accounts. * diff --git a/vtex/server/generated/organization-units/types.gen.ts b/vtex/server/generated/organization-units/types.gen.ts index f72489b0..109bc814 100644 --- a/vtex/server/generated/organization-units/types.gen.ts +++ b/vtex/server/generated/organization-units/types.gen.ts @@ -585,7 +585,7 @@ export type DeleteApiVtexidOrganizationUnitsByOrganizationUnitIdUsersData = { organizationUnitId: string; }; query?: never; - url: '/api//vtexid/organization-units/{organizationUnitId}/users'; + url: '/api/vtexid/organization-units/{organizationUnitId}/users'; }; export type DeleteApiVtexidOrganizationUnitsByOrganizationUnitIdUsersResponses = { @@ -614,7 +614,7 @@ export type GetApiVtexidOrganizationUnitsByOrganizationUnitIdUsersData = { organizationUnitId: string; }; query?: never; - url: '/api//vtexid/organization-units/{organizationUnitId}/users'; + url: '/api/vtexid/organization-units/{organizationUnitId}/users'; }; export type GetApiVtexidOrganizationUnitsByOrganizationUnitIdUsersResponses = { @@ -662,7 +662,7 @@ export type PostApiVtexidOrganizationUnitsByOrganizationUnitIdUsersData = { */ force: boolean; }; - url: '/api//vtexid/organization-units/{organizationUnitId}/users'; + url: '/api/vtexid/organization-units/{organizationUnitId}/users'; }; export type PostApiVtexidOrganizationUnitsByOrganizationUnitIdUsersResponses = { diff --git a/vtex/server/generated/payment-policies/client.gen.ts b/vtex/server/generated/payment-policies/client.gen.ts new file mode 100644 index 00000000..cab3c701 --- /dev/null +++ b/vtex/server/generated/payment-policies/client.gen.ts @@ -0,0 +1,16 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { type ClientOptions, type Config, createClient, createConfig } from './client'; +import type { ClientOptions as ClientOptions2 } from './types.gen'; + +/** + * The `createClientConfig()` function will be called on client initialization + * and the returned object will become the client's initial configuration. + * + * You may want to initialize your client this way instead of calling + * `setConfig()`. This is useful for example if you're using Next.js + * to ensure your client always has the correct values. + */ +export type CreateClientConfig = (override?: Config) => Config & T>; + +export const client = createClient(createConfig()); diff --git a/vtex/server/generated/payment-policies/client/client.gen.ts b/vtex/server/generated/payment-policies/client/client.gen.ts new file mode 100644 index 00000000..d2e55a14 --- /dev/null +++ b/vtex/server/generated/payment-policies/client/client.gen.ts @@ -0,0 +1,288 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { createSseClient } from '../core/serverSentEvents.gen'; +import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; +import type { Client, Config, RequestOptions, ResolvedRequestOptions } from './types.gen'; +import { + buildUrl, + createConfig, + createInterceptors, + getParseAs, + mergeConfigs, + mergeHeaders, + setAuthParams, +} from './utils.gen'; + +type ReqInit = Omit & { + body?: any; + headers: ReturnType; +}; + +export const createClient = (config: Config = {}): Client => { + let _config = mergeConfigs(createConfig(), config); + + const getConfig = (): Config => ({ ..._config }); + + const setConfig = (config: Config): Config => { + _config = mergeConfigs(_config, config); + return getConfig(); + }; + + const interceptors = createInterceptors(); + + const beforeRequest = async (options: RequestOptions) => { + const opts = { + ..._config, + ...options, + fetch: options.fetch ?? _config.fetch ?? globalThis.fetch, + headers: mergeHeaders(_config.headers, options.headers), + serializedBody: undefined, + }; + + if (opts.security) { + await setAuthParams({ + ...opts, + security: opts.security, + }); + } + + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + + if (opts.body !== undefined && opts.bodySerializer) { + opts.serializedBody = opts.bodySerializer(opts.body); + } + + // remove Content-Type header if body is empty to avoid sending invalid requests + if (opts.body === undefined || opts.serializedBody === '') { + opts.headers.delete('Content-Type'); + } + + const url = buildUrl(opts); + + return { opts, url }; + }; + + const request: Client['request'] = async (options) => { + // @ts-expect-error + const { opts, url } = await beforeRequest(options); + const requestInit: ReqInit = { + redirect: 'follow', + ...opts, + body: getValidRequestBody(opts), + }; + + let request = new Request(url, requestInit); + + for (const fn of interceptors.request.fns) { + if (fn) { + request = await fn(request, opts); + } + } + + // fetch must be assigned here, otherwise it would throw the error: + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation + const _fetch = opts.fetch!; + let response: Response; + + try { + response = await _fetch(request); + } catch (error) { + // Handle fetch exceptions (AbortError, network errors, etc.) + let finalError = error; + + for (const fn of interceptors.error.fns) { + if (fn) { + finalError = (await fn(error, undefined as any, request, opts)) as unknown; + } + } + + finalError = finalError || ({} as unknown); + + if (opts.throwOnError) { + throw finalError; + } + + // Return error response + return opts.responseStyle === 'data' + ? undefined + : { + error: finalError, + request, + response: undefined as any, + }; + } + + for (const fn of interceptors.response.fns) { + if (fn) { + response = await fn(response, request, opts); + } + } + + const result = { + request, + response, + }; + + if (response.ok) { + const parseAs = + (opts.parseAs === 'auto' + ? getParseAs(response.headers.get('Content-Type')) + : opts.parseAs) ?? 'json'; + + if (response.status === 204 || response.headers.get('Content-Length') === '0') { + let emptyData: any; + switch (parseAs) { + case 'arrayBuffer': + case 'blob': + case 'text': + emptyData = await response[parseAs](); + break; + case 'formData': + emptyData = new FormData(); + break; + case 'stream': + emptyData = response.body; + break; + case 'json': + default: + emptyData = {}; + break; + } + return opts.responseStyle === 'data' + ? emptyData + : { + data: emptyData, + ...result, + }; + } + + let data: any; + switch (parseAs) { + case 'arrayBuffer': + case 'blob': + case 'formData': + case 'text': + data = await response[parseAs](); + break; + case 'json': { + // Some servers return 200 with no Content-Length and empty body. + // response.json() would throw; read as text and parse if non-empty. + const text = await response.text(); + data = text ? JSON.parse(text) : {}; + break; + } + case 'stream': + return opts.responseStyle === 'data' + ? response.body + : { + data: response.body, + ...result, + }; + } + + if (parseAs === 'json') { + if (opts.responseValidator) { + await opts.responseValidator(data); + } + + if (opts.responseTransformer) { + data = await opts.responseTransformer(data); + } + } + + return opts.responseStyle === 'data' + ? data + : { + data, + ...result, + }; + } + + const textError = await response.text(); + let jsonError: unknown; + + try { + jsonError = JSON.parse(textError); + } catch { + // noop + } + + const error = jsonError ?? textError; + let finalError = error; + + for (const fn of interceptors.error.fns) { + if (fn) { + finalError = (await fn(error, response, request, opts)) as string; + } + } + + finalError = finalError || ({} as string); + + if (opts.throwOnError) { + throw finalError; + } + + // TODO: we probably want to return error and improve types + return opts.responseStyle === 'data' + ? undefined + : { + error: finalError, + ...result, + }; + }; + + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => + request({ ...options, method }); + + const makeSseFn = (method: Uppercase) => async (options: RequestOptions) => { + const { opts, url } = await beforeRequest(options); + return createSseClient({ + ...opts, + body: opts.body as BodyInit | null | undefined, + headers: opts.headers as unknown as Record, + method, + onRequest: async (url, init) => { + let request = new Request(url, init); + for (const fn of interceptors.request.fns) { + if (fn) { + request = await fn(request, opts); + } + } + return request; + }, + serializedBody: getValidRequestBody(opts) as BodyInit | null | undefined, + url, + }); + }; + + return { + buildUrl, + connect: makeMethodFn('CONNECT'), + delete: makeMethodFn('DELETE'), + get: makeMethodFn('GET'), + getConfig, + head: makeMethodFn('HEAD'), + interceptors, + options: makeMethodFn('OPTIONS'), + patch: makeMethodFn('PATCH'), + post: makeMethodFn('POST'), + put: makeMethodFn('PUT'), + request, + setConfig, + sse: { + connect: makeSseFn('CONNECT'), + delete: makeSseFn('DELETE'), + get: makeSseFn('GET'), + head: makeSseFn('HEAD'), + options: makeSseFn('OPTIONS'), + patch: makeSseFn('PATCH'), + post: makeSseFn('POST'), + put: makeSseFn('PUT'), + trace: makeSseFn('TRACE'), + }, + trace: makeMethodFn('TRACE'), + } as Client; +}; diff --git a/vtex/server/generated/payment-policies/client/index.ts b/vtex/server/generated/payment-policies/client/index.ts new file mode 100644 index 00000000..b295edec --- /dev/null +++ b/vtex/server/generated/payment-policies/client/index.ts @@ -0,0 +1,25 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type { Auth } from '../core/auth.gen'; +export type { QuerySerializerOptions } from '../core/bodySerializer.gen'; +export { + formDataBodySerializer, + jsonBodySerializer, + urlSearchParamsBodySerializer, +} from '../core/bodySerializer.gen'; +export { buildClientParams } from '../core/params.gen'; +export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen'; +export { createClient } from './client.gen'; +export type { + Client, + ClientOptions, + Config, + CreateClientConfig, + Options, + RequestOptions, + RequestResult, + ResolvedRequestOptions, + ResponseStyle, + TDataShape, +} from './types.gen'; +export { createConfig, mergeHeaders } from './utils.gen'; diff --git a/vtex/server/generated/payment-policies/client/types.gen.ts b/vtex/server/generated/payment-policies/client/types.gen.ts new file mode 100644 index 00000000..cb6d0d54 --- /dev/null +++ b/vtex/server/generated/payment-policies/client/types.gen.ts @@ -0,0 +1,213 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Auth } from '../core/auth.gen'; +import type { + ServerSentEventsOptions, + ServerSentEventsResult, +} from '../core/serverSentEvents.gen'; +import type { Client as CoreClient, Config as CoreConfig } from '../core/types.gen'; +import type { Middleware } from './utils.gen'; + +export type ResponseStyle = 'data' | 'fields'; + +export interface Config + extends Omit, CoreConfig { + /** + * Base URL for all requests made by this client. + */ + baseUrl?: T['baseUrl']; + /** + * Fetch API implementation. You can use this option to provide a custom + * fetch instance. + * + * @default globalThis.fetch + */ + fetch?: typeof fetch; + /** + * Please don't use the Fetch client for Next.js applications. The `next` + * options won't have any effect. + * + * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead. + */ + next?: never; + /** + * Return the response data parsed in a specified format. By default, `auto` + * will infer the appropriate method from the `Content-Type` response header. + * You can override this behavior with any of the {@link Body} methods. + * Select `stream` if you don't want to parse response data at all. + * + * @default 'auto' + */ + parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text'; + /** + * Should we return only data or multiple fields (data, error, response, etc.)? + * + * @default 'fields' + */ + responseStyle?: ResponseStyle; + /** + * Throw an error instead of returning it in the response? + * + * @default false + */ + throwOnError?: T['throwOnError']; +} + +export interface RequestOptions< + TData = unknown, + TResponseStyle extends ResponseStyle = 'fields', + ThrowOnError extends boolean = boolean, + Url extends string = string, +> + extends + Config<{ + responseStyle: TResponseStyle; + throwOnError: ThrowOnError; + }>, + Pick< + ServerSentEventsOptions, + | 'onSseError' + | 'onSseEvent' + | 'sseDefaultRetryDelay' + | 'sseMaxRetryAttempts' + | 'sseMaxRetryDelay' + > { + /** + * Any body that you want to add to your request. + * + * {@link https://developer.mozilla.org/docs/Web/API/fetch#body} + */ + body?: unknown; + path?: Record; + query?: Record; + /** + * Security mechanism(s) to use for the request. + */ + security?: ReadonlyArray; + url: Url; +} + +export interface ResolvedRequestOptions< + TResponseStyle extends ResponseStyle = 'fields', + ThrowOnError extends boolean = boolean, + Url extends string = string, +> extends RequestOptions { + serializedBody?: string; +} + +export type RequestResult< + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = boolean, + TResponseStyle extends ResponseStyle = 'fields', +> = ThrowOnError extends true + ? Promise< + TResponseStyle extends 'data' + ? TData extends Record + ? TData[keyof TData] + : TData + : { + data: TData extends Record ? TData[keyof TData] : TData; + request: Request; + response: Response; + } + > + : Promise< + TResponseStyle extends 'data' + ? (TData extends Record ? TData[keyof TData] : TData) | undefined + : ( + | { + data: TData extends Record ? TData[keyof TData] : TData; + error: undefined; + } + | { + data: undefined; + error: TError extends Record ? TError[keyof TError] : TError; + } + ) & { + request: Request; + response: Response; + } + >; + +export interface ClientOptions { + baseUrl?: string; + responseStyle?: ResponseStyle; + throwOnError?: boolean; +} + +type MethodFn = < + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = false, + TResponseStyle extends ResponseStyle = 'fields', +>( + options: Omit, 'method'>, +) => RequestResult; + +type SseFn = < + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = false, + TResponseStyle extends ResponseStyle = 'fields', +>( + options: Omit, 'method'>, +) => Promise>; + +type RequestFn = < + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = false, + TResponseStyle extends ResponseStyle = 'fields', +>( + options: Omit, 'method'> & + Pick>, 'method'>, +) => RequestResult; + +type BuildUrlFn = < + TData extends { + body?: unknown; + path?: Record; + query?: Record; + url: string; + }, +>( + options: TData & Options, +) => string; + +export type Client = CoreClient & { + interceptors: Middleware; +}; + +/** + * The `createClientConfig()` function will be called on client initialization + * and the returned object will become the client's initial configuration. + * + * You may want to initialize your client this way instead of calling + * `setConfig()`. This is useful for example if you're using Next.js + * to ensure your client always has the correct values. + */ +export type CreateClientConfig = ( + override?: Config, +) => Config & T>; + +export interface TDataShape { + body?: unknown; + headers?: unknown; + path?: unknown; + query?: unknown; + url: string; +} + +type OmitKeys = Pick>; + +export type Options< + TData extends TDataShape = TDataShape, + ThrowOnError extends boolean = boolean, + TResponse = unknown, + TResponseStyle extends ResponseStyle = 'fields', +> = OmitKeys< + RequestOptions, + 'body' | 'path' | 'query' | 'url' +> & + ([TData] extends [never] ? unknown : Omit); diff --git a/vtex/server/generated/payment-policies/client/utils.gen.ts b/vtex/server/generated/payment-policies/client/utils.gen.ts new file mode 100644 index 00000000..b4bd2435 --- /dev/null +++ b/vtex/server/generated/payment-policies/client/utils.gen.ts @@ -0,0 +1,316 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { getAuthToken } from '../core/auth.gen'; +import type { QuerySerializerOptions } from '../core/bodySerializer.gen'; +import { jsonBodySerializer } from '../core/bodySerializer.gen'; +import { + serializeArrayParam, + serializeObjectParam, + serializePrimitiveParam, +} from '../core/pathSerializer.gen'; +import { getUrl } from '../core/utils.gen'; +import type { Client, ClientOptions, Config, RequestOptions } from './types.gen'; + +export const createQuerySerializer = ({ + parameters = {}, + ...args +}: QuerySerializerOptions = {}) => { + const querySerializer = (queryParams: T) => { + const search: string[] = []; + if (queryParams && typeof queryParams === 'object') { + for (const name in queryParams) { + const value = queryParams[name]; + + if (value === undefined || value === null) { + continue; + } + + const options = parameters[name] || args; + + if (Array.isArray(value)) { + const serializedArray = serializeArrayParam({ + allowReserved: options.allowReserved, + explode: true, + name, + style: 'form', + value, + ...options.array, + }); + if (serializedArray) search.push(serializedArray); + } else if (typeof value === 'object') { + const serializedObject = serializeObjectParam({ + allowReserved: options.allowReserved, + explode: true, + name, + style: 'deepObject', + value: value as Record, + ...options.object, + }); + if (serializedObject) search.push(serializedObject); + } else { + const serializedPrimitive = serializePrimitiveParam({ + allowReserved: options.allowReserved, + name, + value: value as string, + }); + if (serializedPrimitive) search.push(serializedPrimitive); + } + } + } + return search.join('&'); + }; + return querySerializer; +}; + +/** + * Infers parseAs value from provided Content-Type header. + */ +export const getParseAs = (contentType: string | null): Exclude => { + if (!contentType) { + // If no Content-Type header is provided, the best we can do is return the raw response body, + // which is effectively the same as the 'stream' option. + return 'stream'; + } + + const cleanContent = contentType.split(';')[0]?.trim(); + + if (!cleanContent) { + return; + } + + if (cleanContent.startsWith('application/json') || cleanContent.endsWith('+json')) { + return 'json'; + } + + if (cleanContent === 'multipart/form-data') { + return 'formData'; + } + + if ( + ['application/', 'audio/', 'image/', 'video/'].some((type) => cleanContent.startsWith(type)) + ) { + return 'blob'; + } + + if (cleanContent.startsWith('text/')) { + return 'text'; + } + + return; +}; + +const checkForExistence = ( + options: Pick & { + headers: Headers; + }, + name?: string, +): boolean => { + if (!name) { + return false; + } + if ( + options.headers.has(name) || + options.query?.[name] || + options.headers.get('Cookie')?.includes(`${name}=`) + ) { + return true; + } + return false; +}; + +export const setAuthParams = async ({ + security, + ...options +}: Pick, 'security'> & + Pick & { + headers: Headers; + }) => { + for (const auth of security) { + if (checkForExistence(options, auth.name)) { + continue; + } + + const token = await getAuthToken(auth, options.auth); + + if (!token) { + continue; + } + + const name = auth.name ?? 'Authorization'; + + switch (auth.in) { + case 'query': + if (!options.query) { + options.query = {}; + } + options.query[name] = token; + break; + case 'cookie': + options.headers.append('Cookie', `${name}=${token}`); + break; + case 'header': + default: + options.headers.set(name, token); + break; + } + } +}; + +export const buildUrl: Client['buildUrl'] = (options) => + getUrl({ + baseUrl: options.baseUrl as string, + path: options.path, + query: options.query, + querySerializer: + typeof options.querySerializer === 'function' + ? options.querySerializer + : createQuerySerializer(options.querySerializer), + url: options.url, + }); + +export const mergeConfigs = (a: Config, b: Config): Config => { + const config = { ...a, ...b }; + if (config.baseUrl?.endsWith('/')) { + config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1); + } + config.headers = mergeHeaders(a.headers, b.headers); + return config; +}; + +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + +export const mergeHeaders = ( + ...headers: Array['headers'] | undefined> +): Headers => { + const mergedHeaders = new Headers(); + for (const header of headers) { + if (!header) { + continue; + } + + const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header); + + for (const [key, value] of iterator) { + if (value === null) { + mergedHeaders.delete(key); + } else if (Array.isArray(value)) { + for (const v of value) { + mergedHeaders.append(key, v as string); + } + } else if (value !== undefined) { + // assume object headers are meant to be JSON stringified, i.e. their + // content value in OpenAPI specification is 'application/json' + mergedHeaders.set( + key, + typeof value === 'object' ? JSON.stringify(value) : (value as string), + ); + } + } + } + return mergedHeaders; +}; + +type ErrInterceptor = ( + error: Err, + response: Res, + request: Req, + options: Options, +) => Err | Promise; + +type ReqInterceptor = (request: Req, options: Options) => Req | Promise; + +type ResInterceptor = ( + response: Res, + request: Req, + options: Options, +) => Res | Promise; + +class Interceptors { + fns: Array = []; + + clear(): void { + this.fns = []; + } + + eject(id: number | Interceptor): void { + const index = this.getInterceptorIndex(id); + if (this.fns[index]) { + this.fns[index] = null; + } + } + + exists(id: number | Interceptor): boolean { + const index = this.getInterceptorIndex(id); + return Boolean(this.fns[index]); + } + + getInterceptorIndex(id: number | Interceptor): number { + if (typeof id === 'number') { + return this.fns[id] ? id : -1; + } + return this.fns.indexOf(id); + } + + update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false { + const index = this.getInterceptorIndex(id); + if (this.fns[index]) { + this.fns[index] = fn; + return id; + } + return false; + } + + use(fn: Interceptor): number { + this.fns.push(fn); + return this.fns.length - 1; + } +} + +export interface Middleware { + error: Interceptors>; + request: Interceptors>; + response: Interceptors>; +} + +export const createInterceptors = (): Middleware< + Req, + Res, + Err, + Options +> => ({ + error: new Interceptors>(), + request: new Interceptors>(), + response: new Interceptors>(), +}); + +const defaultQuerySerializer = createQuerySerializer({ + allowReserved: false, + array: { + explode: true, + style: 'form', + }, + object: { + explode: true, + style: 'deepObject', + }, +}); + +const defaultHeaders = { + 'Content-Type': 'application/json', +}; + +export const createConfig = ( + override: Config & T> = {}, +): Config & T> => ({ + ...jsonBodySerializer, + headers: defaultHeaders, + parseAs: 'auto', + querySerializer: defaultQuerySerializer, + ...override, +}); diff --git a/vtex/server/generated/payment-policies/core/auth.gen.ts b/vtex/server/generated/payment-policies/core/auth.gen.ts new file mode 100644 index 00000000..3ebf9947 --- /dev/null +++ b/vtex/server/generated/payment-policies/core/auth.gen.ts @@ -0,0 +1,41 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type AuthToken = string | undefined; + +export interface Auth { + /** + * Which part of the request do we use to send the auth? + * + * @default 'header' + */ + in?: 'header' | 'query' | 'cookie'; + /** + * Header or query parameter name. + * + * @default 'Authorization' + */ + name?: string; + scheme?: 'basic' | 'bearer'; + type: 'apiKey' | 'http'; +} + +export const getAuthToken = async ( + auth: Auth, + callback: ((auth: Auth) => Promise | AuthToken) | AuthToken, +): Promise => { + const token = typeof callback === 'function' ? await callback(auth) : callback; + + if (!token) { + return; + } + + if (auth.scheme === 'bearer') { + return `Bearer ${token}`; + } + + if (auth.scheme === 'basic') { + return `Basic ${btoa(token)}`; + } + + return token; +}; diff --git a/vtex/server/generated/payment-policies/core/bodySerializer.gen.ts b/vtex/server/generated/payment-policies/core/bodySerializer.gen.ts new file mode 100644 index 00000000..8ad92c9f --- /dev/null +++ b/vtex/server/generated/payment-policies/core/bodySerializer.gen.ts @@ -0,0 +1,84 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { ArrayStyle, ObjectStyle, SerializerOptions } from './pathSerializer.gen'; + +export type QuerySerializer = (query: Record) => string; + +export type BodySerializer = (body: any) => any; + +type QuerySerializerOptionsObject = { + allowReserved?: boolean; + array?: Partial>; + object?: Partial>; +}; + +export type QuerySerializerOptions = QuerySerializerOptionsObject & { + /** + * Per-parameter serialization overrides. When provided, these settings + * override the global array/object settings for specific parameter names. + */ + parameters?: Record; +}; + +const serializeFormDataPair = (data: FormData, key: string, value: unknown): void => { + if (typeof value === 'string' || value instanceof Blob) { + data.append(key, value); + } else if (value instanceof Date) { + data.append(key, value.toISOString()); + } else { + data.append(key, JSON.stringify(value)); + } +}; + +const serializeUrlSearchParamsPair = (data: URLSearchParams, key: string, value: unknown): void => { + if (typeof value === 'string') { + data.append(key, value); + } else { + data.append(key, JSON.stringify(value)); + } +}; + +export const formDataBodySerializer = { + bodySerializer: | Array>>( + body: T, + ): FormData => { + const data = new FormData(); + + Object.entries(body).forEach(([key, value]) => { + if (value === undefined || value === null) { + return; + } + if (Array.isArray(value)) { + value.forEach((v) => serializeFormDataPair(data, key, v)); + } else { + serializeFormDataPair(data, key, value); + } + }); + + return data; + }, +}; + +export const jsonBodySerializer = { + bodySerializer: (body: T): string => + JSON.stringify(body, (_key, value) => (typeof value === 'bigint' ? value.toString() : value)), +}; + +export const urlSearchParamsBodySerializer = { + bodySerializer: | Array>>(body: T): string => { + const data = new URLSearchParams(); + + Object.entries(body).forEach(([key, value]) => { + if (value === undefined || value === null) { + return; + } + if (Array.isArray(value)) { + value.forEach((v) => serializeUrlSearchParamsPair(data, key, v)); + } else { + serializeUrlSearchParamsPair(data, key, value); + } + }); + + return data.toString(); + }, +}; diff --git a/vtex/server/generated/payment-policies/core/params.gen.ts b/vtex/server/generated/payment-policies/core/params.gen.ts new file mode 100644 index 00000000..6099cab1 --- /dev/null +++ b/vtex/server/generated/payment-policies/core/params.gen.ts @@ -0,0 +1,169 @@ +// This file is auto-generated by @hey-api/openapi-ts + +type Slot = 'body' | 'headers' | 'path' | 'query'; + +export type Field = + | { + in: Exclude; + /** + * Field name. This is the name we want the user to see and use. + */ + key: string; + /** + * Field mapped name. This is the name we want to use in the request. + * If omitted, we use the same value as `key`. + */ + map?: string; + } + | { + in: Extract; + /** + * Key isn't required for bodies. + */ + key?: string; + map?: string; + } + | { + /** + * Field name. This is the name we want the user to see and use. + */ + key: string; + /** + * Field mapped name. This is the name we want to use in the request. + * If `in` is omitted, `map` aliases `key` to the transport layer. + */ + map: Slot; + }; + +export interface Fields { + allowExtra?: Partial>; + args?: ReadonlyArray; +} + +export type FieldsConfig = ReadonlyArray; + +const extraPrefixesMap: Record = { + $body_: 'body', + $headers_: 'headers', + $path_: 'path', + $query_: 'query', +}; +const extraPrefixes = Object.entries(extraPrefixesMap); + +type KeyMap = Map< + string, + | { + in: Slot; + map?: string; + } + | { + in?: never; + map: Slot; + } +>; + +const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { + if (!map) { + map = new Map(); + } + + for (const config of fields) { + if ('in' in config) { + if (config.key) { + map.set(config.key, { + in: config.in, + map: config.map, + }); + } + } else if ('key' in config) { + map.set(config.key, { + map: config.map, + }); + } else if (config.args) { + buildKeyMap(config.args, map); + } + } + + return map; +}; + +interface Params { + body: unknown; + headers: Record; + path: Record; + query: Record; +} + +const stripEmptySlots = (params: Params) => { + for (const [slot, value] of Object.entries(params)) { + if (value && typeof value === 'object' && !Object.keys(value).length) { + delete params[slot as Slot]; + } + } +}; + +export const buildClientParams = (args: ReadonlyArray, fields: FieldsConfig) => { + const params: Params = { + body: {}, + headers: {}, + path: {}, + query: {}, + }; + + const map = buildKeyMap(fields); + + let config: FieldsConfig[number] | undefined; + + for (const [index, arg] of args.entries()) { + if (fields[index]) { + config = fields[index]; + } + + if (!config) { + continue; + } + + if ('in' in config) { + if (config.key) { + const field = map.get(config.key)!; + const name = field.map || config.key; + if (field.in) { + (params[field.in] as Record)[name] = arg; + } + } else { + params.body = arg; + } + } else { + for (const [key, value] of Object.entries(arg ?? {})) { + const field = map.get(key); + + if (field) { + if (field.in) { + const name = field.map || key; + (params[field.in] as Record)[name] = value; + } else { + params[field.map] = value; + } + } else { + const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix)); + + if (extra) { + const [prefix, slot] = extra; + (params[slot] as Record)[key.slice(prefix.length)] = value; + } else if ('allowExtra' in config && config.allowExtra) { + for (const [slot, allowed] of Object.entries(config.allowExtra)) { + if (allowed) { + (params[slot as Slot] as Record)[key] = value; + break; + } + } + } + } + } + } + } + + stripEmptySlots(params); + + return params; +}; diff --git a/vtex/server/generated/payment-policies/core/pathSerializer.gen.ts b/vtex/server/generated/payment-policies/core/pathSerializer.gen.ts new file mode 100644 index 00000000..994b2848 --- /dev/null +++ b/vtex/server/generated/payment-policies/core/pathSerializer.gen.ts @@ -0,0 +1,171 @@ +// This file is auto-generated by @hey-api/openapi-ts + +interface SerializeOptions extends SerializePrimitiveOptions, SerializerOptions {} + +interface SerializePrimitiveOptions { + allowReserved?: boolean; + name: string; +} + +export interface SerializerOptions { + /** + * @default true + */ + explode: boolean; + style: T; +} + +export type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited'; +export type ArraySeparatorStyle = ArrayStyle | MatrixStyle; +type MatrixStyle = 'label' | 'matrix' | 'simple'; +export type ObjectStyle = 'form' | 'deepObject'; +type ObjectSeparatorStyle = ObjectStyle | MatrixStyle; + +interface SerializePrimitiveParam extends SerializePrimitiveOptions { + value: string; +} + +export const separatorArrayExplode = (style: ArraySeparatorStyle) => { + switch (style) { + case 'label': + return '.'; + case 'matrix': + return ';'; + case 'simple': + return ','; + default: + return '&'; + } +}; + +export const separatorArrayNoExplode = (style: ArraySeparatorStyle) => { + switch (style) { + case 'form': + return ','; + case 'pipeDelimited': + return '|'; + case 'spaceDelimited': + return '%20'; + default: + return ','; + } +}; + +export const separatorObjectExplode = (style: ObjectSeparatorStyle) => { + switch (style) { + case 'label': + return '.'; + case 'matrix': + return ';'; + case 'simple': + return ','; + default: + return '&'; + } +}; + +export const serializeArrayParam = ({ + allowReserved, + explode, + name, + style, + value, +}: SerializeOptions & { + value: unknown[]; +}) => { + if (!explode) { + const joinedValues = ( + allowReserved ? value : value.map((v) => encodeURIComponent(v as string)) + ).join(separatorArrayNoExplode(style)); + switch (style) { + case 'label': + return `.${joinedValues}`; + case 'matrix': + return `;${name}=${joinedValues}`; + case 'simple': + return joinedValues; + default: + return `${name}=${joinedValues}`; + } + } + + const separator = separatorArrayExplode(style); + const joinedValues = value + .map((v) => { + if (style === 'label' || style === 'simple') { + return allowReserved ? v : encodeURIComponent(v as string); + } + + return serializePrimitiveParam({ + allowReserved, + name, + value: v as string, + }); + }) + .join(separator); + return style === 'label' || style === 'matrix' ? separator + joinedValues : joinedValues; +}; + +export const serializePrimitiveParam = ({ + allowReserved, + name, + value, +}: SerializePrimitiveParam) => { + if (value === undefined || value === null) { + return ''; + } + + if (typeof value === 'object') { + throw new Error( + 'Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.', + ); + } + + return `${name}=${allowReserved ? value : encodeURIComponent(value)}`; +}; + +export const serializeObjectParam = ({ + allowReserved, + explode, + name, + style, + value, + valueOnly, +}: SerializeOptions & { + value: Record | Date; + valueOnly?: boolean; +}) => { + if (value instanceof Date) { + return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`; + } + + if (style !== 'deepObject' && !explode) { + let values: string[] = []; + Object.entries(value).forEach(([key, v]) => { + values = [...values, key, allowReserved ? (v as string) : encodeURIComponent(v as string)]; + }); + const joinedValues = values.join(','); + switch (style) { + case 'form': + return `${name}=${joinedValues}`; + case 'label': + return `.${joinedValues}`; + case 'matrix': + return `;${name}=${joinedValues}`; + default: + return joinedValues; + } + } + + const separator = separatorObjectExplode(style); + const joinedValues = Object.entries(value) + .map(([key, v]) => + serializePrimitiveParam({ + allowReserved, + name: style === 'deepObject' ? `${name}[${key}]` : key, + value: v as string, + }), + ) + .join(separator); + return style === 'label' || style === 'matrix' ? separator + joinedValues : joinedValues; +}; diff --git a/vtex/server/generated/payment-policies/core/queryKeySerializer.gen.ts b/vtex/server/generated/payment-policies/core/queryKeySerializer.gen.ts new file mode 100644 index 00000000..5000df60 --- /dev/null +++ b/vtex/server/generated/payment-policies/core/queryKeySerializer.gen.ts @@ -0,0 +1,117 @@ +// This file is auto-generated by @hey-api/openapi-ts + +/** + * JSON-friendly union that mirrors what Pinia Colada can hash. + */ +export type JsonValue = + | null + | string + | number + | boolean + | JsonValue[] + | { [key: string]: JsonValue }; + +/** + * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes. + */ +export const queryKeyJsonReplacer = (_key: string, value: unknown) => { + if (value === undefined || typeof value === 'function' || typeof value === 'symbol') { + return undefined; + } + if (typeof value === 'bigint') { + return value.toString(); + } + if (value instanceof Date) { + return value.toISOString(); + } + return value; +}; + +/** + * Safely stringifies a value and parses it back into a JsonValue. + */ +export const stringifyToJsonValue = (input: unknown): JsonValue | undefined => { + try { + const json = JSON.stringify(input, queryKeyJsonReplacer); + if (json === undefined) { + return undefined; + } + return JSON.parse(json) as JsonValue; + } catch { + return undefined; + } +}; + +/** + * Detects plain objects (including objects with a null prototype). + */ +const isPlainObject = (value: unknown): value is Record => { + if (value === null || typeof value !== 'object') { + return false; + } + const prototype = Object.getPrototypeOf(value as object); + return prototype === Object.prototype || prototype === null; +}; + +/** + * Turns URLSearchParams into a sorted JSON object for deterministic keys. + */ +const serializeSearchParams = (params: URLSearchParams): JsonValue => { + const entries = Array.from(params.entries()).sort(([a], [b]) => a.localeCompare(b)); + const result: Record = {}; + + for (const [key, value] of entries) { + const existing = result[key]; + if (existing === undefined) { + result[key] = value; + continue; + } + + if (Array.isArray(existing)) { + (existing as string[]).push(value); + } else { + result[key] = [existing, value]; + } + } + + return result; +}; + +/** + * Normalizes any accepted value into a JSON-friendly shape for query keys. + */ +export const serializeQueryKeyValue = (value: unknown): JsonValue | undefined => { + if (value === null) { + return null; + } + + if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { + return value; + } + + if (value === undefined || typeof value === 'function' || typeof value === 'symbol') { + return undefined; + } + + if (typeof value === 'bigint') { + return value.toString(); + } + + if (value instanceof Date) { + return value.toISOString(); + } + + if (Array.isArray(value)) { + return stringifyToJsonValue(value); + } + + if (typeof URLSearchParams !== 'undefined' && value instanceof URLSearchParams) { + return serializeSearchParams(value); + } + + if (isPlainObject(value)) { + return stringifyToJsonValue(value); + } + + return undefined; +}; diff --git a/vtex/server/generated/payment-policies/core/serverSentEvents.gen.ts b/vtex/server/generated/payment-policies/core/serverSentEvents.gen.ts new file mode 100644 index 00000000..6aa6cf02 --- /dev/null +++ b/vtex/server/generated/payment-policies/core/serverSentEvents.gen.ts @@ -0,0 +1,243 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Config } from './types.gen'; + +export type ServerSentEventsOptions = Omit & + Pick & { + /** + * Fetch API implementation. You can use this option to provide a custom + * fetch instance. + * + * @default globalThis.fetch + */ + fetch?: typeof fetch; + /** + * Implementing clients can call request interceptors inside this hook. + */ + onRequest?: (url: string, init: RequestInit) => Promise; + /** + * Callback invoked when a network or parsing error occurs during streaming. + * + * This option applies only if the endpoint returns a stream of events. + * + * @param error The error that occurred. + */ + onSseError?: (error: unknown) => void; + /** + * Callback invoked when an event is streamed from the server. + * + * This option applies only if the endpoint returns a stream of events. + * + * @param event Event streamed from the server. + * @returns Nothing (void). + */ + onSseEvent?: (event: StreamEvent) => void; + serializedBody?: RequestInit['body']; + /** + * Default retry delay in milliseconds. + * + * This option applies only if the endpoint returns a stream of events. + * + * @default 3000 + */ + sseDefaultRetryDelay?: number; + /** + * Maximum number of retry attempts before giving up. + */ + sseMaxRetryAttempts?: number; + /** + * Maximum retry delay in milliseconds. + * + * Applies only when exponential backoff is used. + * + * This option applies only if the endpoint returns a stream of events. + * + * @default 30000 + */ + sseMaxRetryDelay?: number; + /** + * Optional sleep function for retry backoff. + * + * Defaults to using `setTimeout`. + */ + sseSleepFn?: (ms: number) => Promise; + url: string; + }; + +export interface StreamEvent { + data: TData; + event?: string; + id?: string; + retry?: number; +} + +export type ServerSentEventsResult = { + stream: AsyncGenerator< + TData extends Record ? TData[keyof TData] : TData, + TReturn, + TNext + >; +}; + +export const createSseClient = ({ + onRequest, + onSseError, + onSseEvent, + responseTransformer, + responseValidator, + sseDefaultRetryDelay, + sseMaxRetryAttempts, + sseMaxRetryDelay, + sseSleepFn, + url, + ...options +}: ServerSentEventsOptions): ServerSentEventsResult => { + let lastEventId: string | undefined; + + const sleep = sseSleepFn ?? ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms))); + + const createStream = async function* () { + let retryDelay: number = sseDefaultRetryDelay ?? 3000; + let attempt = 0; + const signal = options.signal ?? new AbortController().signal; + + while (true) { + if (signal.aborted) break; + + attempt++; + + const headers = + options.headers instanceof Headers + ? options.headers + : new Headers(options.headers as Record | undefined); + + if (lastEventId !== undefined) { + headers.set('Last-Event-ID', lastEventId); + } + + try { + const requestInit: RequestInit = { + redirect: 'follow', + ...options, + body: options.serializedBody, + headers, + signal, + }; + let request = new Request(url, requestInit); + if (onRequest) { + request = await onRequest(url, requestInit); + } + // fetch must be assigned here, otherwise it would throw the error: + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation + const _fetch = options.fetch ?? globalThis.fetch; + const response = await _fetch(request); + + if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`); + + if (!response.body) throw new Error('No body in SSE response'); + + const reader = response.body.pipeThrough(new TextDecoderStream()).getReader(); + + let buffer = ''; + + const abortHandler = () => { + try { + reader.cancel(); + } catch { + // noop + } + }; + + signal.addEventListener('abort', abortHandler); + + try { + while (true) { + const { done, value } = await reader.read(); + if (done) break; + buffer += value; + // Normalize line endings: CRLF -> LF, then CR -> LF + buffer = buffer.replace(/\r\n/g, '\n').replace(/\r/g, '\n'); + + const chunks = buffer.split('\n\n'); + buffer = chunks.pop() ?? ''; + + for (const chunk of chunks) { + const lines = chunk.split('\n'); + const dataLines: Array = []; + let eventName: string | undefined; + + for (const line of lines) { + if (line.startsWith('data:')) { + dataLines.push(line.replace(/^data:\s*/, '')); + } else if (line.startsWith('event:')) { + eventName = line.replace(/^event:\s*/, ''); + } else if (line.startsWith('id:')) { + lastEventId = line.replace(/^id:\s*/, ''); + } else if (line.startsWith('retry:')) { + const parsed = Number.parseInt(line.replace(/^retry:\s*/, ''), 10); + if (!Number.isNaN(parsed)) { + retryDelay = parsed; + } + } + } + + let data: unknown; + let parsedJson = false; + + if (dataLines.length) { + const rawData = dataLines.join('\n'); + try { + data = JSON.parse(rawData); + parsedJson = true; + } catch { + data = rawData; + } + } + + if (parsedJson) { + if (responseValidator) { + await responseValidator(data); + } + + if (responseTransformer) { + data = await responseTransformer(data); + } + } + + onSseEvent?.({ + data, + event: eventName, + id: lastEventId, + retry: retryDelay, + }); + + if (dataLines.length) { + yield data as any; + } + } + } + } finally { + signal.removeEventListener('abort', abortHandler); + reader.releaseLock(); + } + + break; // exit loop on normal completion + } catch (error) { + // connection failed or aborted; retry after delay + onSseError?.(error); + + if (sseMaxRetryAttempts !== undefined && attempt >= sseMaxRetryAttempts) { + break; // stop after firing error + } + + // exponential backoff: double retry each attempt, cap at 30s + const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 30000); + await sleep(backoff); + } + } + }; + + const stream = createStream(); + + return { stream }; +}; diff --git a/vtex/server/generated/payment-policies/core/types.gen.ts b/vtex/server/generated/payment-policies/core/types.gen.ts new file mode 100644 index 00000000..97463257 --- /dev/null +++ b/vtex/server/generated/payment-policies/core/types.gen.ts @@ -0,0 +1,104 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Auth, AuthToken } from './auth.gen'; +import type { BodySerializer, QuerySerializer, QuerySerializerOptions } from './bodySerializer.gen'; + +export type HttpMethod = + | 'connect' + | 'delete' + | 'get' + | 'head' + | 'options' + | 'patch' + | 'post' + | 'put' + | 'trace'; + +export type Client< + RequestFn = never, + Config = unknown, + MethodFn = never, + BuildUrlFn = never, + SseFn = never, +> = { + /** + * Returns the final request URL. + */ + buildUrl: BuildUrlFn; + getConfig: () => Config; + request: RequestFn; + setConfig: (config: Config) => Config; +} & { + [K in HttpMethod]: MethodFn; +} & ([SseFn] extends [never] ? { sse?: never } : { sse: { [K in HttpMethod]: SseFn } }); + +export interface Config { + /** + * Auth token or a function returning auth token. The resolved value will be + * added to the request payload as defined by its `security` array. + */ + auth?: ((auth: Auth) => Promise | AuthToken) | AuthToken; + /** + * A function for serializing request body parameter. By default, + * {@link JSON.stringify()} will be used. + */ + bodySerializer?: BodySerializer | null; + /** + * An object containing any HTTP headers that you want to pre-populate your + * `Headers` object with. + * + * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more} + */ + headers?: + | RequestInit['headers'] + | Record< + string, + string | number | boolean | (string | number | boolean)[] | null | undefined | unknown + >; + /** + * The request method. + * + * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more} + */ + method?: Uppercase; + /** + * A function for serializing request query parameters. By default, arrays + * will be exploded in form style, objects will be exploded in deepObject + * style, and reserved characters are percent-encoded. + * + * This method will have no effect if the native `paramsSerializer()` Axios + * API function is used. + * + * {@link https://swagger.io/docs/specification/serialization/#query View examples} + */ + querySerializer?: QuerySerializer | QuerySerializerOptions; + /** + * A function validating request data. This is useful if you want to ensure + * the request conforms to the desired shape, so it can be safely sent to + * the server. + */ + requestValidator?: (data: unknown) => Promise; + /** + * A function transforming response data before it's returned. This is useful + * for post-processing data, e.g. converting ISO strings into Date objects. + */ + responseTransformer?: (data: unknown) => Promise; + /** + * A function validating response data. This is useful if you want to ensure + * the response conforms to the desired shape, so it can be safely passed to + * the transformers and returned to the user. + */ + responseValidator?: (data: unknown) => Promise; +} + +type IsExactlyNeverOrNeverUndefined = [T] extends [never] + ? true + : [T] extends [never | undefined] + ? [undefined] extends [T] + ? false + : true + : false; + +export type OmitNever> = { + [K in keyof T as IsExactlyNeverOrNeverUndefined extends true ? never : K]: T[K]; +}; diff --git a/vtex/server/generated/payment-policies/core/utils.gen.ts b/vtex/server/generated/payment-policies/core/utils.gen.ts new file mode 100644 index 00000000..e7ddbe35 --- /dev/null +++ b/vtex/server/generated/payment-policies/core/utils.gen.ts @@ -0,0 +1,140 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; +import { + type ArraySeparatorStyle, + serializeArrayParam, + serializeObjectParam, + serializePrimitiveParam, +} from './pathSerializer.gen'; + +export interface PathSerializer { + path: Record; + url: string; +} + +export const PATH_PARAM_RE = /\{[^{}]+\}/g; + +export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { + let url = _url; + const matches = _url.match(PATH_PARAM_RE); + if (matches) { + for (const match of matches) { + let explode = false; + let name = match.substring(1, match.length - 1); + let style: ArraySeparatorStyle = 'simple'; + + if (name.endsWith('*')) { + explode = true; + name = name.substring(0, name.length - 1); + } + + if (name.startsWith('.')) { + name = name.substring(1); + style = 'label'; + } else if (name.startsWith(';')) { + name = name.substring(1); + style = 'matrix'; + } + + const value = path[name]; + + if (value === undefined || value === null) { + continue; + } + + if (Array.isArray(value)) { + url = url.replace(match, serializeArrayParam({ explode, name, style, value })); + continue; + } + + if (typeof value === 'object') { + url = url.replace( + match, + serializeObjectParam({ + explode, + name, + style, + value: value as Record, + valueOnly: true, + }), + ); + continue; + } + + if (style === 'matrix') { + url = url.replace( + match, + `;${serializePrimitiveParam({ + name, + value: value as string, + })}`, + ); + continue; + } + + const replaceValue = encodeURIComponent( + style === 'label' ? `.${value as string}` : (value as string), + ); + url = url.replace(match, replaceValue); + } + } + return url; +}; + +export const getUrl = ({ + baseUrl, + path, + query, + querySerializer, + url: _url, +}: { + baseUrl?: string; + path?: Record; + query?: Record; + querySerializer: QuerySerializer; + url: string; +}) => { + const pathUrl = _url.startsWith('/') ? _url : `/${_url}`; + let url = (baseUrl ?? '') + pathUrl; + if (path) { + url = defaultPathSerializer({ path, url }); + } + let search = query ? querySerializer(query) : ''; + if (search.startsWith('?')) { + search = search.substring(1); + } + if (search) { + url += `?${search}`; + } + return url; +}; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // not all clients implement a serializedBody property (i.e. client-axios) + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/vtex/server/generated/payment-policies/index.ts b/vtex/server/generated/payment-policies/index.ts new file mode 100644 index 00000000..1a14bfe8 --- /dev/null +++ b/vtex/server/generated/payment-policies/index.ts @@ -0,0 +1,4 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export { createPolicyRule, deletePolicyRule, evaluatePaymentPolicies, getPolicyRuleById, listPolicyRules, type Options, updatePolicyRule } from './sdk.gen'; +export type { Accept, ClientOptions, ContentType, CreatePolicyRuleData, CreatePolicyRuleError, CreatePolicyRuleErrors, CreatePolicyRuleResponse, CreatePolicyRuleResponses, DeletePolicyRuleData, DeletePolicyRuleError, DeletePolicyRuleErrors, DeletePolicyRuleResponse, DeletePolicyRuleResponses, EvaluatePaymentPoliciesData, EvaluatePaymentPoliciesError, EvaluatePaymentPoliciesErrors, EvaluatePaymentPoliciesResponse, EvaluatePaymentPoliciesResponses, GetPolicyRuleByIdData, GetPolicyRuleByIdError, GetPolicyRuleByIdErrors, GetPolicyRuleByIdResponse, GetPolicyRuleByIdResponses, JsonLogicExpression, ListPolicyRulesData, ListPolicyRulesError, ListPolicyRulesErrors, ListPolicyRulesResponse, ListPolicyRulesResponses, PaymentPolicySearchItem, PaymentPolicySearchRequest, PaymentPolicySearchResponse, PaymentSystemDefinition, PolicyRule, PolicyRuleId, PolicyRuleInput, ProblemDetails, UpdatePolicyRuleData, UpdatePolicyRuleError, UpdatePolicyRuleErrors, UpdatePolicyRuleResponse, UpdatePolicyRuleResponses, Validator } from './types.gen'; diff --git a/vtex/server/generated/payment-policies/sdk.gen.ts b/vtex/server/generated/payment-policies/sdk.gen.ts new file mode 100644 index 00000000..15fe1353 --- /dev/null +++ b/vtex/server/generated/payment-policies/sdk.gen.ts @@ -0,0 +1,205 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Client, Options as Options2, TDataShape } from './client'; +import { client } from './client.gen'; +import type { CreatePolicyRuleData, CreatePolicyRuleErrors, CreatePolicyRuleResponses, DeletePolicyRuleData, DeletePolicyRuleErrors, DeletePolicyRuleResponses, EvaluatePaymentPoliciesData, EvaluatePaymentPoliciesErrors, EvaluatePaymentPoliciesResponses, GetPolicyRuleByIdData, GetPolicyRuleByIdErrors, GetPolicyRuleByIdResponses, ListPolicyRulesData, ListPolicyRulesErrors, ListPolicyRulesResponses, UpdatePolicyRuleData, UpdatePolicyRuleErrors, UpdatePolicyRuleResponses } from './types.gen'; + +export type Options = Options2 & { + /** + * You can provide a client instance returned by `createClient()` instead of + * individual options. This might be also useful if you want to implement a + * custom client. + */ + client?: Client; + /** + * You can pass arbitrary values through the `meta` object. This can be + * used to access values that aren't defined as part of the SDK function. + */ + meta?: Record; +}; + +/** + * List policy rules + * + * Lists the payment policy rules configured for the VTEX account identified by the `accountName` URL variable. + * + * > ⚠️ This feature is in closed beta, meaning only specific customers can access it now. If you want to implement it in the future, please contact [our Support](https://support.vtex.com/hc/en-us/). + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/authentication-overview#api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise, they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | PCI Gateway | Payment-Make Payments | **View Payment Data** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. + * + * To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication-overview#machine-authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const listPolicyRules = (options: Options) => (options.client ?? client).get({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/payment-configuration-service/policy-rules', + ...options +}); + +/** + * Create policy rule + * + * Creates a payment policy rule for the VTEX account identified by the `accountName` URL variable. Policy rules define conditions that determine which payment systems are included or excluded when those conditions match a cart item. + * + * > ⚠️ This feature is in closed beta, meaning only specific customers can access it now. If you want to implement it in the future, please contact [our Support](https://support.vtex.com/hc/en-us/). + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/authentication-overview#api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise, they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Payments | Payment Policies | **ManageStore** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. + * + * To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication-overview#machine-authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const createPolicyRule = (options: Options) => (options.client ?? client).post({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/payment-configuration-service/policy-rules', + ...options +}); + +/** + * Delete policy rule + * + * Deletes a payment policy rule for the VTEX account identified by the `accountName` URL variable. + * + * > ⚠️ This feature is in closed beta, meaning only specific customers can access it now. If you want to implement it in the future, please contact [our Support](https://support.vtex.com/hc/en-us/). + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/authentication-overview#api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise, they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Payments | Payment Policies | **ManageStore** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. + * + * To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication-overview#machine-authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const deletePolicyRule = (options: Options) => (options.client ?? client).delete({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/payment-configuration-service/policy-rules/{id}', + ...options +}); + +/** + * Get policy rule by ID + * + * Retrieves a payment policy rule by ID for the VTEX account identified by the `accountName` URL variable. + * + * > ⚠️ This feature is in closed beta, meaning only specific customers can access it now. If you want to implement it in the future, please contact [our Support](https://support.vtex.com/hc/en-us/). + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/authentication-overview#api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise, they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | PCI Gateway | Payment-Make Payments | **View Payment Data** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. + * + * To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication-overview#machine-authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const getPolicyRuleById = (options: Options) => (options.client ?? client).get({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/payment-configuration-service/policy-rules/{id}', + ...options +}); + +/** + * Update policy rule + * + * Replaces a payment policy rule for the VTEX account identified by the `accountName` URL variable. Send the same request body used to create a rule. Do not include response-only fields such as `id`, `createdAt`, or `updatedAt`, and do not send a `version` field because concurrency is handled server-side. + * + * > ⚠️ This feature is in closed beta, meaning only specific customers can access it now. If you want to implement it in the future, please contact [our Support](https://support.vtex.com/hc/en-us/). + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/authentication-overview#api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise, they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | Payments | Payment Policies | **ManageStore** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. + * + * To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication-overview#machine-authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const updatePolicyRule = (options: Options) => (options.client ?? client).put({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/payment-configuration-service/policy-rules/{id}', + ...options +}); + +/** + * Evaluate payment policies + * + * Evaluates active payment policy rules against cart item context and returns payment systems available for each item. Payment systems not mentioned in any matching rule remain available by default. You can also use this endpoint to validate which payment systems are available for cart items before checkout continues. + * + * > ⚠️ This feature is in closed beta, meaning only specific customers can access it now. If you want to implement it in the future, please contact [our Support](https://support.vtex.com/hc/en-us/). + * + * ## Permissions + * + * Any user or [API key](https://developers.vtex.com/docs/guides/authentication-overview#api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise, they will receive a status code `403` error. These are the applicable resources for this endpoint: + * + * | **Product** | **Category** | **Resource** | + * | --------------- | ----------------- | ----------------- | + * | PCI Gateway | Payment-Make Payments | **View Payment Data** | + * + * There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. + * + * To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication-overview#machine-authentication). + * + * >❗ To prevent integrations from having excessive permissions, consider the [best practices for managing API keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations. + */ +export const evaluatePaymentPolicies = (options: Options) => (options.client ?? client).post({ + security: [ + { name: 'X-VTEX-API-AppKey', type: 'apiKey' }, + { name: 'X-VTEX-API-AppToken', type: 'apiKey' }, + { name: 'VtexIdclientAutCookie', type: 'apiKey' } + ], + url: '/api/pvt/payment-systems/search', + ...options +}); diff --git a/vtex/server/generated/payment-policies/types.gen.ts b/vtex/server/generated/payment-policies/types.gen.ts new file mode 100644 index 00000000..1e2f4a88 --- /dev/null +++ b/vtex/server/generated/payment-policies/types.gen.ts @@ -0,0 +1,660 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type ClientOptions = { + baseUrl: 'https://{accountName}.pcs.vtexcommercestable.com.br' | 'https://{accountName}.vtexpayments.com.br' | 'https://{accountName}.pcs.vtexcommercestable.com.br' | 'https://{accountName}.pcs.vtexcommercestable.com.br' | 'https://{accountName}.pcs.vtexcommercestable.com.br' | 'https://{accountName}.pcs.vtexcommercestable.com.br' | 'https://{accountName}.pcs.vtexcommercestable.com.br' | 'https://{accountName}.vtexpayments.com.br' | (string & {}); +}; + +/** + * Payload used to create or replace a payment policy rule. + */ +export type PolicyRuleInput = { + /** + * Policy rule name. + */ + name: string; + expression: JsonLogicExpression; + /** + * Indicates whether the policy rule is active. + */ + enabled: boolean; + /** + * Rule priority, from `0` to `999`. Lower values have higher precedence when conflicting rules match the same item. + */ + priority: number; + /** + * Action applied to the payment systems when the rule expression matches. Accepts `Include` or `Exclude`; value matching is case-insensitive. + */ + action: 'Include' | 'Exclude'; + /** + * Payment system IDs affected by the rule. + */ + paymentSystems: Array; +}; + +/** + * Payment policy rule returned by the API. + */ +export type PolicyRule = { + /** + * Unique identifier of the policy rule. + */ + id: string; + /** + * Policy rule name. + */ + name: string; + expression: JsonLogicExpression; + /** + * Indicates whether the policy rule is active. + */ + enabled: boolean; + /** + * Rule priority, from `0` to `999`. Lower values have higher precedence when conflicting rules match the same item. + */ + priority: number; + /** + * Action applied to the payment systems when the rule expression matches. Accepts `Include` or `Exclude`; value matching is case-insensitive. + */ + action: 'Include' | 'Exclude'; + /** + * Payment system IDs affected by the rule. + */ + paymentSystems: Array; + /** + * Date and time when the policy rule was created in [ISO 8601 time zone offset format](https://learn.microsoft.com/en-us/rest/api/storageservices/formatting-datetime-values), as in `YYYY-MM-DDThh:mm:ssZ`. + */ + createdAt: string; + /** + * Date and time when the policy rule was last updated in [ISO 8601 time zone offset format](https://learn.microsoft.com/en-us/rest/api/storageservices/formatting-datetime-values), as in `YYYY-MM-DDThh:mm:ssZ`. + */ + updatedAt: string; +}; + +/** + * JSONLogic expression evaluated against item context. Currently supports `and`, `or`, `==`, and `in`, with `collectionIds` and `shippingState` as available variables. + */ +export type JsonLogicExpression = { + [key: string]: unknown; +}; + +/** + * Payload used to evaluate payment policies for cart items. Supports the same catalog filters as the merchant payment systems GET (`salesChannel`, `paymentSystemIds`), plus line items for policy evaluation. + */ +export type PaymentPolicySearchRequest = { + /** + * Sales channel ID or name. When omitted, null, or whitespace, all sales channels are considered. + */ + salesChannel?: string; + /** + * Optional subset of payment system IDs to consider from the merchant catalog before applying policy rules. When omitted or empty, no additional catalog filter is applied. + */ + paymentSystemIds?: Array; + /** + * Cart items to evaluate against active payment policy rules. + */ + items: Array; +}; + +/** + * Cart item context used by the payment policy engine. + */ +export type PaymentPolicySearchItem = { + /** + * Item identifier used to map available payment systems back to the cart item. + */ + id: string; + /** + * Collection IDs associated with the item in the VTEX catalog. + */ + collectionIds?: Array; + /** + * Shipping context used by the payment policy engine. + */ + shippingData?: { + /** + * State code of the main delivery address. + */ + state: string; + }; +}; + +/** + * Payment policy evaluation result returned by the Payment Information Service. + */ +export type PaymentPolicySearchResponse = { + /** + * Map of item IDs to the payment system IDs allowed for each item. + */ + paymentSystemAssignments: { + [key: string]: Array; + }; + /** + * Payment system metadata for the payment systems returned in the assignments. + */ + paymentSystemDefinitions: Array; +}; + +/** + * Available payment methods response body information. + */ +export type PaymentSystemDefinition = { + /** + * Payment method identification. + */ + id: number; + /** + * Payment method name. + */ + name: string; + /** + * Indicates whether a document is required. + */ + requiresDocument?: boolean; + /** + * Payment method implementation class name. + */ + implementation?: string; + /** + * Connector (payment provider) implementation class name. + */ + connectorImplementation?: string; + /** + * Connector (anti-fraud provider) implementation class name. + */ + antifraudConnectorImplementation?: string | null; + /** + * Payment group name. + */ + groupName: string; + /** + * Indicates whether the payment method allows redirection. + */ + redirect?: boolean; + /** + * Indicates whether it is custom. + */ + isCustom?: boolean; + /** + * Indicates whether the payment is automatically authorized. + */ + isSelfAuthorized?: boolean; + /** + * Indicates whether it is necessary to log in to make the payment. + */ + requiresAuthentication?: boolean; + /** + * Indicates whether the payment method allows installments. + */ + allowInstallments?: boolean; + /** + * Indicates whether it is possible to restrict the use of specific BIN codes (only applicable for cards). + */ + allowBinExclusion?: boolean; + /** + * Indicates whether the method allows multiple payments. Example of `false`: debit card. + */ + allowMultiple?: boolean; + /** + * Indicates whether it is possible to identify the name of the bank responsible for issuing the card. + */ + allowIssuer?: boolean; + /** + * Indicates whether it is possible to restrict a payment rule by the country where the purchase is made. + */ + allowCountry?: boolean; + /** + * Indicates whether to restrict a payment rule by commercial policy type. + */ + allowCommercialPolicy?: boolean; + /** + * Indicates whether to restrict a payment rule by commercial condition type. + */ + allowCommercialCondition?: boolean; + /** + * Indicates whether it is possible to restrict a period for making the payment. + */ + allowPeriod?: boolean; + /** + * Indicates whether the payment method is available for use. + */ + isAvailable?: boolean; + /** + * Description of the payment method. + */ + description?: string | null; + /** + * Indicates whether the payment method supports recurrence. + */ + supportRecurrence?: boolean; + /** + * Validator information. + */ + validator?: { + /** + * [Regex](https://regexr.com/) information. + */ + regex: string | null; + /** + * Validator mask. + */ + mask: string | null; + /** + * Card code regular mask. + */ + cardCodeMask: string | null; + /** + * Card code regular expression. + */ + cardCodeRegex: string | null; + /** + * Array containing weigths information. + */ + weights: Array | null; + /** + * Indicates whether it is necessary to use the CVV code to complete a transaction with payment made by card. + */ + useCvv: boolean; + /** + * Indicates whether it is necessary to use the expiration date to complete a card payment transaction. + */ + useExpirationDate: boolean; + /** + * Indicates whether it is necessary to use the card holder name to complete a payment transaction made by card. + */ + useCardHolderName: boolean; + /** + * Indicates whether it is necessary to use the billing address to complete a card payment transaction. + */ + useBillingAddress: boolean; + /** + * Information about valid card lengths. + */ + validCardLengths: string | null; + }; + /** + * App dependencies information. + */ + appDependencies?: string | null; + /** + * Indicates whether a document is shown. + */ + displayDocument?: boolean; + /** + * Payment due date. + */ + dueDate?: string; + /** + * Indicates the possibility of payment notification (used by bank invoices and notes payable). + */ + allowNotification?: boolean; + /** + * Affiliation connector (payment provider) identification. + */ + affiliationId?: string | null; + /** + * Information about payment availability. + */ + availablePayments?: string | null; + /** + * Amount of time (in minutes) until the payment date (`dueDate`). + */ + dueDateMinutes?: number; +}; + +/** + * Validator information. + */ +export type Validator = { + /** + * [Regex](https://regexr.com/) information. + */ + regex: string | null; + /** + * Validator mask. + */ + mask: string | null; + /** + * Card code regular mask. + */ + cardCodeMask: string | null; + /** + * Card code regular expression. + */ + cardCodeRegex: string | null; + /** + * Array containing weigths information. + */ + weights: Array | null; + /** + * Indicates whether it is necessary to use the CVV code to complete a transaction with payment made by card. + */ + useCvv: boolean; + /** + * Indicates whether it is necessary to use the expiration date to complete a card payment transaction. + */ + useExpirationDate: boolean; + /** + * Indicates whether it is necessary to use the card holder name to complete a payment transaction made by card. + */ + useCardHolderName: boolean; + /** + * Indicates whether it is necessary to use the billing address to complete a card payment transaction. + */ + useBillingAddress: boolean; + /** + * Information about valid card lengths. + */ + validCardLengths: string | null; +}; + +/** + * RFC 7807 Problem Details response returned when the request cannot be completed. + */ +export type ProblemDetails = { + /** + * URI reference that identifies the problem type. + */ + type: string; + /** + * Short, human-readable summary of the problem type. + */ + title: string; + /** + * HTTP status code generated by the server for this occurrence of the problem. + */ + status: number; + /** + * Human-readable explanation specific to this occurrence of the problem. + */ + detail: string; + /** + * URI reference that identifies the specific occurrence of the problem. + */ + instance: string; +}; + +/** + * Type of the content being sent. + */ +export type ContentType = string; + +/** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ +export type Accept = string; + +/** + * Unique identifier of the policy rule. + */ +export type PolicyRuleId = string; + +export type ListPolicyRulesData = { + body?: never; + headers: { + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path?: never; + query?: never; + url: '/api/payment-configuration-service/policy-rules'; +}; + +export type ListPolicyRulesErrors = { + /** + * Unauthorized + */ + 401: ProblemDetails; + /** + * Forbidden + */ + 403: ProblemDetails; +}; + +export type ListPolicyRulesError = ListPolicyRulesErrors[keyof ListPolicyRulesErrors]; + +export type ListPolicyRulesResponses = { + /** + * List of policy rules configured for the account. + */ + 200: Array; +}; + +export type ListPolicyRulesResponse = ListPolicyRulesResponses[keyof ListPolicyRulesResponses]; + +export type CreatePolicyRuleData = { + body: PolicyRuleInput; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path?: never; + query?: never; + url: '/api/payment-configuration-service/policy-rules'; +}; + +export type CreatePolicyRuleErrors = { + /** + * Bad Request + */ + 400: ProblemDetails; + /** + * Unauthorized + */ + 401: ProblemDetails; + /** + * Forbidden + */ + 403: ProblemDetails; + /** + * Unprocessable Content + */ + 422: ProblemDetails; +}; + +export type CreatePolicyRuleError = CreatePolicyRuleErrors[keyof CreatePolicyRuleErrors]; + +export type CreatePolicyRuleResponses = { + /** + * Created + */ + 201: PolicyRule; +}; + +export type CreatePolicyRuleResponse = CreatePolicyRuleResponses[keyof CreatePolicyRuleResponses]; + +export type DeletePolicyRuleData = { + body?: never; + path: { + /** + * Unique identifier of the policy rule. + */ + id: string; + }; + query?: never; + url: '/api/payment-configuration-service/policy-rules/{id}'; +}; + +export type DeletePolicyRuleErrors = { + /** + * Unauthorized + */ + 401: ProblemDetails; + /** + * Forbidden + */ + 403: ProblemDetails; + /** + * Not Found + */ + 404: ProblemDetails; +}; + +export type DeletePolicyRuleError = DeletePolicyRuleErrors[keyof DeletePolicyRuleErrors]; + +export type DeletePolicyRuleResponses = { + /** + * No Content + */ + 204: void; +}; + +export type DeletePolicyRuleResponse = DeletePolicyRuleResponses[keyof DeletePolicyRuleResponses]; + +export type GetPolicyRuleByIdData = { + body?: never; + headers: { + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path: { + /** + * Unique identifier of the policy rule. + */ + id: string; + }; + query?: never; + url: '/api/payment-configuration-service/policy-rules/{id}'; +}; + +export type GetPolicyRuleByIdErrors = { + /** + * Unauthorized + */ + 401: ProblemDetails; + /** + * Forbidden + */ + 403: ProblemDetails; + /** + * Not Found + */ + 404: ProblemDetails; +}; + +export type GetPolicyRuleByIdError = GetPolicyRuleByIdErrors[keyof GetPolicyRuleByIdErrors]; + +export type GetPolicyRuleByIdResponses = { + /** + * OK + */ + 200: PolicyRule; +}; + +export type GetPolicyRuleByIdResponse = GetPolicyRuleByIdResponses[keyof GetPolicyRuleByIdResponses]; + +export type UpdatePolicyRuleData = { + body: PolicyRuleInput; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path: { + /** + * Unique identifier of the policy rule. + */ + id: string; + }; + query?: never; + url: '/api/payment-configuration-service/policy-rules/{id}'; +}; + +export type UpdatePolicyRuleErrors = { + /** + * Bad Request + */ + 400: ProblemDetails; + /** + * Unauthorized + */ + 401: ProblemDetails; + /** + * Forbidden + */ + 403: ProblemDetails; + /** + * Not Found + */ + 404: ProblemDetails; + /** + * Conflict + */ + 409: ProblemDetails; + /** + * Unprocessable Content + */ + 422: ProblemDetails; +}; + +export type UpdatePolicyRuleError = UpdatePolicyRuleErrors[keyof UpdatePolicyRuleErrors]; + +export type UpdatePolicyRuleResponses = { + /** + * OK + */ + 200: PolicyRule; +}; + +export type UpdatePolicyRuleResponse = UpdatePolicyRuleResponses[keyof UpdatePolicyRuleResponses]; + +export type EvaluatePaymentPoliciesData = { + body: PaymentPolicySearchRequest; + headers: { + /** + * Type of the content being sent. + */ + 'Content-Type': string; + /** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ + Accept: string; + }; + path?: never; + query?: never; + url: '/api/pvt/payment-systems/search'; +}; + +export type EvaluatePaymentPoliciesErrors = { + /** + * Bad Request + */ + 400: ProblemDetails; + /** + * Unauthorized + */ + 401: ProblemDetails; + /** + * Forbidden + */ + 403: ProblemDetails; + /** + * Request Timeout + */ + 408: string; +}; + +export type EvaluatePaymentPoliciesError = EvaluatePaymentPoliciesErrors[keyof EvaluatePaymentPoliciesErrors]; + +export type EvaluatePaymentPoliciesResponses = { + /** + * OK + */ + 200: PaymentPolicySearchResponse; +}; + +export type EvaluatePaymentPoliciesResponse = EvaluatePaymentPoliciesResponses[keyof EvaluatePaymentPoliciesResponses]; diff --git a/vtex/server/generated/payment-policies/zod.gen.ts b/vtex/server/generated/payment-policies/zod.gen.ts new file mode 100644 index 00000000..2681a1a6 --- /dev/null +++ b/vtex/server/generated/payment-policies/zod.gen.ts @@ -0,0 +1,263 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import * as z from 'zod'; + +/** + * JSONLogic expression evaluated against item context. Currently supports `and`, `or`, `==`, and `in`, with `collectionIds` and `shippingState` as available variables. + */ +export const zJsonLogicExpression = z.record(z.string(), z.unknown()); + +/** + * Payload used to create or replace a payment policy rule. + */ +export const zPolicyRuleInput = z.object({ + name: z.string().min(1), + expression: zJsonLogicExpression, + enabled: z.boolean(), + priority: z.int().gte(0).lte(999), + action: z.enum(['Include', 'Exclude']), + paymentSystems: z.array(z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' })).min(1) +}); + +/** + * Payment policy rule returned by the API. + */ +export const zPolicyRule = z.object({ + id: z.string(), + name: z.string().min(1), + expression: zJsonLogicExpression, + enabled: z.boolean(), + priority: z.int().gte(0).lte(999), + action: z.enum(['Include', 'Exclude']), + paymentSystems: z.array(z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' })).min(1), + createdAt: z.iso.datetime(), + updatedAt: z.iso.datetime() +}); + +/** + * Cart item context used by the payment policy engine. + */ +export const zPaymentPolicySearchItem = z.object({ + id: z.string(), + collectionIds: z.optional(z.array(z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }))), + shippingData: z.optional(z.object({ + state: z.string() + })) +}); + +/** + * Payload used to evaluate payment policies for cart items. Supports the same catalog filters as the merchant payment systems GET (`salesChannel`, `paymentSystemIds`), plus line items for policy evaluation. + */ +export const zPaymentPolicySearchRequest = z.object({ + salesChannel: z.optional(z.string()), + paymentSystemIds: z.optional(z.array(z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }))), + items: z.array(zPaymentPolicySearchItem) +}); + +/** + * Available payment methods response body information. + */ +export const zPaymentSystemDefinition = z.object({ + id: z.number(), + name: z.string(), + requiresDocument: z.optional(z.boolean()), + implementation: z.optional(z.string()), + connectorImplementation: z.optional(z.string()), + antifraudConnectorImplementation: z.optional(z.union([ + z.string(), + z.null() + ])), + groupName: z.string(), + redirect: z.optional(z.boolean()), + isCustom: z.optional(z.boolean()), + isSelfAuthorized: z.optional(z.boolean()), + requiresAuthentication: z.optional(z.boolean()), + allowInstallments: z.optional(z.boolean()), + allowBinExclusion: z.optional(z.boolean()), + allowMultiple: z.optional(z.boolean()), + allowIssuer: z.optional(z.boolean()), + allowCountry: z.optional(z.boolean()), + allowCommercialPolicy: z.optional(z.boolean()), + allowCommercialCondition: z.optional(z.boolean()), + allowPeriod: z.optional(z.boolean()), + isAvailable: z.optional(z.boolean()), + description: z.optional(z.union([ + z.string(), + z.null() + ])), + supportRecurrence: z.optional(z.boolean()), + validator: z.optional(z.object({ + regex: z.union([ + z.string(), + z.null() + ]), + mask: z.union([ + z.string(), + z.null() + ]), + cardCodeMask: z.union([ + z.string(), + z.null() + ]), + cardCodeRegex: z.union([ + z.string(), + z.null() + ]), + weights: z.union([ + z.array(z.int()), + z.null() + ]), + useCvv: z.boolean(), + useExpirationDate: z.boolean(), + useCardHolderName: z.boolean(), + useBillingAddress: z.boolean(), + validCardLengths: z.union([ + z.string(), + z.null() + ]) + })), + appDependencies: z.optional(z.union([ + z.string(), + z.null() + ])), + displayDocument: z.optional(z.boolean()), + dueDate: z.optional(z.string()), + allowNotification: z.optional(z.boolean()), + affiliationId: z.optional(z.union([ + z.string(), + z.null() + ])), + availablePayments: z.optional(z.union([ + z.string(), + z.null() + ])), + dueDateMinutes: z.optional(z.number()) +}); + +/** + * Payment policy evaluation result returned by the Payment Information Service. + */ +export const zPaymentPolicySearchResponse = z.object({ + paymentSystemAssignments: z.record(z.string(), z.array(z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }))), + paymentSystemDefinitions: z.array(zPaymentSystemDefinition) +}); + +/** + * Validator information. + */ +export const zValidator = z.object({ + regex: z.union([ + z.string(), + z.null() + ]), + mask: z.union([ + z.string(), + z.null() + ]), + cardCodeMask: z.union([ + z.string(), + z.null() + ]), + cardCodeRegex: z.union([ + z.string(), + z.null() + ]), + weights: z.union([ + z.array(z.int()), + z.null() + ]), + useCvv: z.boolean(), + useExpirationDate: z.boolean(), + useCardHolderName: z.boolean(), + useBillingAddress: z.boolean(), + validCardLengths: z.union([ + z.string(), + z.null() + ]) +}); + +/** + * RFC 7807 Problem Details response returned when the request cannot be completed. + */ +export const zProblemDetails = z.object({ + type: z.string(), + title: z.string(), + status: z.int().gte(100).lte(599), + detail: z.string(), + instance: z.string() +}); + +/** + * Type of the content being sent. + */ +export const zContentType = z.string(); + +/** + * HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand. + */ +export const zAccept = z.string(); + +/** + * Unique identifier of the policy rule. + */ +export const zPolicyRuleId = z.string(); + +export const zListPolicyRulesData = z.object({ + body: z.optional(z.never()), + path: z.optional(z.never()), + query: z.optional(z.never()), + headers: z.object({ + Accept: z.string() + }) +}); + +export const zCreatePolicyRuleData = z.object({ + body: zPolicyRuleInput, + path: z.optional(z.never()), + query: z.optional(z.never()), + headers: z.object({ + 'Content-Type': z.string(), + Accept: z.string() + }) +}); + +export const zDeletePolicyRuleData = z.object({ + body: z.optional(z.never()), + path: z.object({ + id: z.string() + }), + query: z.optional(z.never()) +}); + +export const zGetPolicyRuleByIdData = z.object({ + body: z.optional(z.never()), + path: z.object({ + id: z.string() + }), + query: z.optional(z.never()), + headers: z.object({ + Accept: z.string() + }) +}); + +export const zUpdatePolicyRuleData = z.object({ + body: zPolicyRuleInput, + path: z.object({ + id: z.string() + }), + query: z.optional(z.never()), + headers: z.object({ + 'Content-Type': z.string(), + Accept: z.string() + }) +}); + +export const zEvaluatePaymentPoliciesData = z.object({ + body: zPaymentPolicySearchRequest, + path: z.optional(z.never()), + query: z.optional(z.never()), + headers: z.object({ + 'Content-Type': z.string(), + Accept: z.string() + }) +}); diff --git a/vtex/server/generated/payment-provider-protocol/sdk.gen.ts b/vtex/server/generated/payment-provider-protocol/sdk.gen.ts index 9099c173..13cb0c20 100644 --- a/vtex/server/generated/payment-provider-protocol/sdk.gen.ts +++ b/vtex/server/generated/payment-provider-protocol/sdk.gen.ts @@ -41,6 +41,7 @@ export type Options(op export const _2SendPaymentsPublic = (options: Options) => (options.client ?? client).post({ url: '/api/payments/transactions/{transactionId}/payments', ...options }); /** - * Update additional data (optional) + * Update additional data * - * This request is used to update any information that has previously been sent on endpoint [Send additional data](https://developers.vtex.com/docs/api-reference/payments-gateway-api#post-/api/pvt/transactions/-transactionId-/additional-data). + * This request is used to update any information that has previously been sent on endpoint [Send additional data](https://developers.vtex.com/docs/api-reference/payments-gateway-api#post-/api/pvt/transactions/-transactionId-/additional-data), if required. * * ## Permissions * @@ -495,7 +495,9 @@ export const transactionDetails = (options /** * Get payment details * - * Returns data about a specific payment made in your store. + * Returns data about all payments created for a transaction or a specific payment made in your store. + * + * >⚠️ To get information about a specific payment, use the `paymentId` parameter in the request path. * * ## Permissions * diff --git a/vtex/server/generated/payments-gateway/types.gen.ts b/vtex/server/generated/payments-gateway/types.gen.ts index 909b304d..d9c5fec5 100644 --- a/vtex/server/generated/payments-gateway/types.gen.ts +++ b/vtex/server/generated/payments-gateway/types.gen.ts @@ -15,14 +15,86 @@ export type ValidRequest = { /** * Installments information. */ - installments: Array; + installments: Array<{ + /** + * Payment system information. + */ + payment: { + /** + * Payment system identification. + */ + id: number; + /** + * Payment system name. + */ + name: string | null; + /** + * First six digits of the card number. + */ + bin: string | null; + /** + * Value to be paid in installments. + */ + value: number; + /** + * Indicates whether the payment system is automatically applied by default. + */ + isDefault: boolean; + /** + * Object containing the payment system reference route. + */ + self: { + /** + * Payment system reference route. + */ + href: string; + }; + }; + /** + * Array containing information about installment options. + */ + options: Array